Fog Juice Posted June 17, 2009 Share Posted June 17, 2009 Hello, What I am trying to do is select the latest version of each uuid. Latest is determined by the unix time stamp in the date column. Below is the table with data, could someone give me a hint on how to do this? This probably seems easy but sometimes the easiest things are overlooked. Thanks! CREATE TABLE IF NOT EXISTS `phpfreakstableexample` ( `id` int(11) NOT NULL AUTO_INCREMENT, `uuid` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `date` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `note` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=225 ;] INSERT INTO `phpfreakstableexample` (`id`, `uuid`, `date`, `note`) VALUES (1, '472541d7-3c51-8b2d-5acf-ea1d25cfacaa', '1245223150', 'test data for phpfreaks'), (2, 'd6e52102-dfa9-c570-7550-fe92d5517329', '1245223987', 'test data for phpfreaks'), (3, 'c4601d4c-d55e-16b3-11ff-85abba78a19a', '1245223988', 'test data for phpfreaks'), (4, 'c4601d4c-d55e-16b3-11ff-85abba78a19a', '1245223989', 'test data for phpfreaks'), (5, 'c4601d4c-d55e-16b3-11ff-85abba78a19a', '1245223990', 'test data for phpfreaks'), (6, 'd6e52102-dfa9-c570-7550-fe92d5517329', '1245223991', 'test data for phpfreaks'), (7, '472541d7-3c51-8b2d-5acf-ea1d25cfacaa', '1245223192', 'test data for phpfreaks'), (8, '472541d7-3c51-8b2d-5acf-ea1d25cfacaa', '1245223193', 'test data for phpfreaks'), (9, '472541d7-3c51-8b2d-5acf-ea1d25cfacaa', '1245223194', 'test data for phpfreaks'), Quote Link to comment https://forums.phpfreaks.com/topic/162674-select-max-date-of-column-where-with-multiple-uuids/ Share on other sites More sharing options...
fenway Posted June 18, 2009 Share Posted June 18, 2009 It's not "solved" until you post the solution. Quote Link to comment https://forums.phpfreaks.com/topic/162674-select-max-date-of-column-where-with-multiple-uuids/#findComment-859092 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.