I have a MySQL table with following data (sample);
UserId - DeviceId - StartDate - EndDate
------------------------------------------------------
1001 D119822 11/27/2011 12/02/2011
1001 D198726 11/27/2011 12/02/2011
1001 D552833 11/27/2011 12/02/2011
1001 D980993 11/27/2011 12/02/2011
I have searched for some kind of row_num or ordinal_position thing, but found nothing.
How could I get the latest record from the above table without adding a serial/auto increment number column?
Try this query, i have tested it and it works for me.