Hi, I need to select the max value from a set of records but I also need the primary key for that record.
The problem is that the record id may not be the same as the record max value for the column as in the following example: Table_x Id x_col date_col 1 1 2005-04-11 2 1 2005-03-10 3 1 2005-04-12 4 1 2001-01-01 with SELECT id, x_col, max(date_col) FROM table_x GROUP BY x_col I would probably get the following result Id x_col date_col 4 1 2005-04-12 and what I would like to get is Id x_col date_col 3 1 2005-04-12 Is there a way to do that ? Thanks in advance Mauricio -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]