i need to select. the most recent item from mysql table. I found several suggestions but nobody was the right one for my case.
Just to recap i have a table with id, itemnr, date_edited
I tried with:
select id, itemnr, max(date_edited) as date_edited from table group by itemnr
the result is the list of item, grouped by itemnr, but not the last one (so where the date_edited is the most recent)
where is the problem?
Mysql database:
CREATE TABLE `table` (
`id` int(11) NOT NULL,
`itemnr` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT 'TBD',
`date_edited` datetime NOT NULL
COLLATE latin1_general_ci NOT NULL DEFAULT '0' COMMENT '0 = created, 1=modified, 2=deleted',
`csc` date NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;