SELECT f.id AS id, f.client AS client, f.customer_id AS customer_id, f.bill_email AS bill_email FROM ( SELECT client, max(id) AS top_id FROM activity GROUP BY client ) AS x INNER JOIN activity AS f ON f.client = x.client and f.id = x.top_id;
Thursday, August 28, 2008
MySQL Select the maximum row in each group
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment