Re: join table with itself?

From: William Leite Araújo <william(dot)bh(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: join table with itself?
Date: 2007-03-15 15:57:06
Message-ID: bc63ad820703150857h2ff195b0wac18476730b19c3c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 15/03/07, T E Schmitz <mailreg(at)numerixtechnology(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Scott Marlowe 2007-03-15 16:13:18 Re: Alter Table
Previous Message T E Schmitz 2007-03-15 15:45:08 join table with itself?