Jump to content

Recommended Posts

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'),

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.