Given the following table \'foo
\'
ID | First Name | Last Name
----------------------------
67 John Smith
----------------------------
6
MySQLs group by is not consistent with the standard SQL behaviour , MySQL makes it easy to get other columns BUT at the same time u can never be sure which one u will get.
Update: refer to this page: http://dev.mysql.com/doc/refman/5.0/en/group-by-handling.html
When using this feature, all rows in each group should have the same values for the columns that are ommitted from the GROUP BY part. The server is free to return any value from the group, so the results are indeterminate unless all values are the same.