I don't see how rollup will help you here. As I understand it, you want to GROUP BY Schedule_ID, and for each group you want to see the row with the maximal Schedule_lastupdated. The manual suggests three solutions to this problem <http://www.mysql.com/doc/en/example-Maximum-row.html>.

Michael

Pradeep Kumar wrote:

Hi All,
I have a complex query on master-child tables that returns this data

Schedule ID Schedule Comments Schedule_lastupdated(timestamp datatype)

301 Test TIMESTAMP1

301 Test2 TIMESTAMP2

302 ok TIMESTAMP3

302 ok2 TIMESTAMP4



Now from this data i want only the rows with the latest timestamp(max schedule_lastupdated) FOR EACH SCHEDULE ID like

301 Test2 TIMESTAMP2

302 ok2 TIMESTAMP4

how do I do that?

Should I use with rollup if so on what columns.?

Regards
Pradeep Kumar



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



Reply via email to