From: Rodrigo De León <rdeleonp@gmail.com>
To: Philippe Lang <philippe.lang@attiksystem.ch>
Cc: pgsql-sql@postgresql.org
Subject: Re: Table transform query
Date: Tue, 18 Sep 2007 08:51:17 -0500
Message-ID: <a55915760709180651p4df78cfm59dc219bdd6729ce@mail.gmail.com> (raw)
In-Reply-To: <6C0CF58A187DA5479245E0830AF84F4218CF1F@poweredge.attiksystem.ch>
References: <6C0CF58A187DA5479245E0830AF84F4218CF1F@poweredge.attiksystem.ch>
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 IS NULL)
ORDER BY t1.serial
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: rdeleonp@gmail.com, philippe.lang@attiksystem.ch
Subject: Re: Table transform query
In-Reply-To: <a55915760709180651p4df78cfm59dc219bdd6729ce@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox