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_id FROM bank_account GROUP 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 Gardner <[EMAIL PROTECTED]> (was [EMAIL PROTECTED]) Live Free, Use Linux! ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster