|
|||||||||||
|
Re: [GENERAL] a JOIN on same table, but 'slided over'
From: Gurjeet Singh <singh.gurjeet(at)gmail.com>
Date: Tue Jun 26 2007 - 08:35:46 EDT
Just a note that this is not standard SQL... 'distinct on' is an extension to SQL provided by postgres. Following query utilizes the standard SQL to get the same results: select t1.id as id, t2.id as "id+1",
t1.thread as thread, t2.thread as "thread+1",
t1.info as info, t2.info as "info+1"
from test as t1, test as t2
where t2.id = ( select min(id) from test as t3 where t3.id > t1.id); HTH
--
gurjeet[.singh]@EnterpriseDB.com
singh.gurjeet@{ gmail | hotmail | indiatimes | yahoo }.com
17°29'34.37"N 78°30'59.76"E - Hyderabad *
18°32'57.25"N 73°56'25.42"E - Pune
Sent from my BlackLaptop device
On 6/26/07, Rafal Pietrak
Received on Tue Jun 26 08:37:01 2007This archive was generated by hypermail 2.1.8 : Tue Jun 26 2007 - 08:40:03 EDT |
||||||||||
|
|||||||||||