Re: SQL problem: bank account

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SQL problem: bank account
Дата
Msg-id 7888.1054561357@sss.pgh.pa.us
обсуждение исходный текст
Ответ на SQL problem: bank account  ("Erik G. Burrows" <eburrows@erikburrows.com>)
Ответы Re: SQL problem: bank account  ("Erik G. Burrows" <eburrows@erikburrows.com>)
Список pgsql-sql
"Erik G. Burrows" <eburrows@erikburrows.com> writes:
> I need to get the most recent transaction for each customer. I need only
> the transaction ID, but the entire row would be best.

If you don't mind a not-standard-SQL solution, the SELECT DISTINCT ON
construct is designed for this sort of thing.  See the "weather report"
example in the SELECT reference page.
        regards, tom lane


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

Предыдущее
От: Rado Petrik
Дата:
Сообщение: Using & - operator
Следующее
От: Dmitry Tkach
Дата:
Сообщение: Re: SQL problem: bank account