Re: Table transform query - Mailing list pgsql-sql

From Rodrigo De León
Subject Re: Table transform query
Date
Msg-id a55915760709180651p4df78cfm59dc219bdd6729ce@mail.gmail.com
Whole thread Raw
In response to Table transform query  ("Philippe Lang" <philippe.lang@attiksystem.ch>)
Responses Re: Table transform query
List pgsql-sql
On 9/18/07, Philippe Lang <philippe.lang@attiksystem.ch> wrote:
> ... into this:
>
>
> serial  dateL  dateR
> --------------------
> 1       1      2
> 1       4
> 2       1      2
> 3       1      3
> 4       2      3
> 5       3

SELECT   t1.serial, t1.DATE AS datel, t2.DATE AS dater   FROM t t1 LEFT JOIN t t2 ON(    t1.serial = t2.serial
                    AND t1.DATE < t2.DATE)  WHERE t1.delivery = 'L'    AND (   t2.delivery = 'R'         OR t2.delivery
ISNULL)
 
ORDER BY t1.serial


pgsql-sql by date:

Previous
From: "Philippe Lang"
Date:
Subject: Re: Table transform query
Next
From: Tom Lane
Date:
Subject: Re: error dropping operator