Search Postgresql Archives

Re: "joining" table records

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 21, 2017 at 9:47 AM, Moreno Andreo <moreno.andreo@xxxxxxxxxx> 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.


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux