From: William Leite Araújo <william.bh@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: join table with itself?
Date: Thu, 15 Mar 2007 12:57:06 -0300
Message-ID: <bc63ad820703150857h2ff195b0wac18476730b19c3c@mail.gmail.com> (raw)
In-Reply-To: <45F96A04.7020307@numerixtechnology.de>
References: <45F96A04.7020307@numerixtechnology.de>
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
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: william.bh@gmail.com
Subject: Re: join table with itself?
In-Reply-To: <bc63ad820703150857h2ff195b0wac18476730b19c3c@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