Select *, max(date) works in phpMyAdmin but not in my code
Posted
by kdobrev
on Stack Overflow
See other posts from Stack Overflow
or by kdobrev
Published on 2010-05-08T11:23:25Z
Indexed on
2010/05/08
11:28 UTC
Read the original article
Hit count: 273
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 BYegidORDER BYegidDESC ;
This is may table:
CREATE TABLE
employee_groups(egidint(10) unsigned NOT NULL,datedate NOT NULL,group_namevarchar(50) NOT NULL,limitsmallint(5) unsigned NOT NULL, PRIMARY KEY (egid,date) ) ENGINE=MyISAM DEFAULT CHARSET=cp1251;
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).
© Stack Overflow or respective owner