Re: "joining" table records

From: Moreno Andreo <moreno(dot)andreo(at)evolu-s(dot)it>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: "joining" table records
Date: 2017-06-22 09:43:39
Message-ID: c85389c3-1003-767d-4565-d89d311a6885@evolu-s.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Il 21/06/2017 19:11, David G. Johnston ha scritto:
> On Wed, Jun 21, 2017 at 9:47 AM, Moreno Andreo <moreno(dot)andreo(at)evolu-s(dot)it> wrote:
>> I have this table
>>
>> rec_code | rec_date | int1 | int2 |
>> 10 2014-07-21 3 4
>> 11 2014-07-21 5
>> 10 2015-01-04 1 2
>> 11 2016-02-05 6
>>
>> That's the result I need to get from a SELECT statement
>>
>> rec_date | int1 | int2 | tempvalue
>> 2014-07-21 3 4 5
>> 2015-01-04 1 2
>> 2016-02-05 6
> It seems you want something like:
>
> SELECT ...
> FROM (SELECT WHERE rec_code = 10) r10
> FULL JOIN (SELECT WHERE rec_code = 11) r11 USING (rec_date)
>
> David J.
>
Hi David,
exactly what I needed!

(ok, I'm going to RTFM :-)) )

Thanks a lot!
Have a nice day,
Moreno.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Joseph Krogh 2017-06-22 10:38:12 Re: pglogical vs. built-in logical replication in pg-10
Previous Message Achilleas Mantzios 2017-06-22 09:43:02 Re: pglogical vs. built-in logical replication in pg-10