I am trying to get a list of each ID's top ID record, but when I enter this query:
select max(submitted), t.* from ods.events t where id in
(262, 331, 144, 664, 353, 641, 190, 527, 581) group by id;
I get the following:
+---------------------+-----+---------------------+
| max(submitted) | id | submitted |
+---------------------+-----+---------------------+
| 2015-03-17 14:39:53 | 144 | 2014-04-14 04:57:09 |
| 2015-03-03 08:30:15 | 190 | 2014-04-14 01:51:01 |
| 2015-03-17 13:40:14 | 262 | 2014-04-14 03:56:03 |
| 2015-03-17 06:45:10 | 331 | 2014-04-14 05:51:02 |
| 2015-03-17 14:39:41 | 353 | 2014-04-14 05:50:30 |
| 2015-03-17 06:45:39 | 527 | 2014-04-13 21:38:14 |
| 2015-03-17 15:41:32 | 581 | 2014-04-14 05:54:43 |
| 2015-03-17 15:40:26 | 641 | 2014-04-14 05:52:10 |
| 2015-03-17 15:42:10 | 664 | 2014-04-14 05:53:44 |
+---------------------+-----+---------------------+
Apparently it is not bringing the entire record associated with the max(submitted), but some other record. How do I bring in the entire record associated with the max(submitted)?