From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Moreno Andreo <moreno(dot)andreo(at)evolu-s(dot)it> |
Cc: | PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: "joining" table records |
Date: | 2017-06-21 17:11:43 |
Message-ID: | CAKFQuwZoccSr_DO3u9BPg_Q0R_Lgf0cY-1q9HGiEtdfZ24yPHA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Longwill | 2017-06-21 17:24:54 | Error when building new db using pg_restore |
Previous Message | Paul Jungwirth | 2017-06-21 16:50:06 | Re: Cookbook for doing installation and configuration of PostgreSQL on Redhat |