Page is a not externally linkable
- Code, Content, and Presentation
-- Databases
---- MySQL - MAX in LEFT JOIN TABLE


ovideuss - 10:23 am on Nov 2, 2011 (gmt 0)


SELECT orders.*,MAX(downloads.attempt)
FROM orders
LEFT JOIN downloads on downloads.orderid = orders.id
GROUP BY orders.id
HAVING orders.userid = '123'

Replace orders.id with whatever you want to group by.


Thread source:: http://www.webmasterworld.com/databases_sql_mysql/4382491.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com