Re: SELECT Question

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: SELECT Question
Дата
Msg-id 20060303171501.GA15289@wolff.to
обсуждение исходный текст
Ответ на SELECT Question  (Alex <alex@meerkatsoft.com>)
Список pgsql-general
On Sat, Mar 04, 2006 at 03:35:02 +1100,
  Alex <alex@meerkatsoft.com> wrote:
> Hi,
> i want to calculate the price difference, change% of 2 price records. Is
> there an easy way to do that within one query, rather than writing a
> function?

You can use a self join to do this. It won't be spectaculatly fast though.
The idea is too join each record to the record with the largest date less
than the date of the current record. Note that on record won't have a match.

В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: ERROR: column "datpath" does not exist
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Problem with function that returns a cursor