There is likely a blindingly obvious solution to this, I need to do a group by expression in my query and get the latest row based on a date field in the same table. Is this even possible, and any tips on how to do that?
Example of data and query: ------- Table: =(pseudo table based on origional, trimmed)= 'id', 'bigint(20)', '', 'PRI', '', 'auto_increment' 'date', 'datetime', '', '', '0000-00-00 00:00:00', '' 'serial_number', 'varchar(25)', '', '', '', '' 'pass', 'varchar(6)', '', '', 'false', '' = SELECT t.pass, t.id FROM theTable t group by t.serial_number ------- I have tried putting a sort into the query like so: SELECT t.pass, t.id FROM theTable t GROUP BY t.serial_number ORDER BY t.date desc Which naturally only sorts the resulting rows by date.