Ysgrifennodd Tim McIntyre:
Next pint is on me Peter;-) The following turned out to be exactly what I needed:

SELECT s1.id
FROM status_histories s1
WHERE s1.type = 'StatusHistoryOrder'
AND s1.code = 1
AND s1.created_at = (SELECT MAX(s2.created_at)
                                      FROM status_histories s2
                                      WHERE s1.order_id = s2.order_id)

And yes my MAX function does seem to work.

Thanks a ton!
Tim
Just got lucky

:)


Peter


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to