Re: SQL problem: bank account

Поиск
Список
Период
Сортировка
От Jonathan Gardner
Тема Re: SQL problem: bank account
Дата
Msg-id 200306020620.56966.jgardner@smoothcorp.com
обсуждение исходный текст
Ответ на Re: SQL problem: bank account  ("listrec" <listrec@epecon.de>)
Список pgsql-sql
On Monday 02 June 2003 00:49, listrec wrote:
> How about:
>
> select max(transaction_id) from bank_account group by customer_id
>

And if you want the rest of the data in the rows:

SELECT b.*
FROM bank_account b
JOIN  (SELECT max(transaction_id) AS transaction_idFROM bank_accountGROUP BY customer_id
) AS subselect ON subselect.transaction_id=b.transaction_id
;

I use a similar query here at work to find the first time a guy has visited 
our site through an advertiser.

-- 
Jonathan M. Gardner
Smooth Corporation - Perl Programmer
jgardner@smoothcorp.com - (425) 460-4780
Live Free, Use Linux!


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

Предыдущее
От: Jonathan Gardner
Дата:
Сообщение: Re: SQL problem: bank account
Следующее
От: "Erik G. Burrows"
Дата:
Сообщение: Re: SQL problem: bank account