Re: join table with itself? - Mailing list pgsql-sql

From William Leite Araújo
Subject Re: join table with itself?
Date
Msg-id bc63ad820703150857h2ff195b0wac18476730b19c3c@mail.gmail.com
Whole thread Raw
In response to join table with itself?  (T E Schmitz <mailreg@numerixtechnology.de>)
Responses Re: join table with itself?  (T E Schmitz <mailreg@numerixtechnology.de>)
List pgsql-sql
On 15/03/07, T E Schmitz <mailreg@numerixtechnology.de> wrote:
(...)
 
   Try join the tables.

SELECT  present.day, present.low, (MIN(future.day)-present.day) as
days2fall FROM history AS present JOIN history AS future ON ( present.day < future.day AND
     future.low <= present.low )
GROUP BY present.day,present.low
ORDER BY days2fall DESC


--
William Leite Araújo
Analista de Banco de Dados - QualiConsult

pgsql-sql by date:

Previous
From: T E Schmitz
Date:
Subject: join table with itself?
Next
From: Scott Marlowe
Date:
Subject: Re: Alter Table