Take the 2-minute tour ×  OK, my statement executes well in
phpMyAdmin, but not how I expect it in my php page.  This is my
statement:  SELECT `egid`, `group_name` , `limit`, MAX( `date` )
FROM employee_groups  GROUP BY `egid`  ORDER BY `egid` DESC ;
This is may table:  CREATE TABLE `employee_groups` (   `egid`
int(10) unsigned NOT NULL,   `date` date NOT NULL,
`group_name` varchar(50) NOT NULL,   `limit` smallint(5)
unsigned NOT NULL,   PRIMARY KEY (`egid`,`date`)  I want to
extract the most recent list of groups, e.g. if a group has been
changed I want to have only the last change. And I need it as a
list (all groups).  share|improve this question Can you post the
PHP code you're using? –  awgy May 8 '10 at 11:25 "not how I
expect it" What did you expect, and what did you get? –  Mark
Byers May 8 '10 at 13:45 add comment  2 Answers  up vote 1 down
vote accepted  Your query might be broken. You should not select
fields that aren't in the group by unless one of the following
two conditions apply:    • Yo