Hi,
I have a log table: tenantid (int), users (int), updated (datetime). I would like to select latest record for each distinct tenantid in the table. Any help would be greatly appreciated. Table example:
+----------+-------+-------------------------+ | tenantid | users | updated | +----------+-------+-------------------------+ | 16 | 5 | 2019-08-29 11:14:38.913 | | 3 | 0 | 2019-08-16 21:29:40.530 | | 13 | 7 | 2019-08-16 21:29:40.530 | | 9 | 0 | 2019-08-16 21:29:40.527 | | 4 | 8 | 2019-08-16 21:29:40.527 | | 18 | 13 | 2019-08-16 21:29:40.523 | | 12 | 0 | 2019-08-16 21:29:40.520 | | 8 | 0 | 2019-08-16 21:29:40.520 | | 21 | 15 | 2019-08-16 21:29:40.517 | | 19 | 5 | 2019-08-16 21:29:40.513 | | 7 | 0 | 2019-08-16 21:29:40.510 | | 20 | 2 | 2019-08-16 21:29:40.507 | | 10 | 0 | 2019-08-16 21:29:40.507 | | 0 | 38 | 2019-08-16 21:29:40.503 | | 5 | 0 | 2019-08-16 21:29:40.500 | | 15 | 0 | 2019-08-16 21:29:40.500 | | 6 | 0 | 2019-08-16 21:29:40.497 | | 17 | 0 | 2019-08-16 21:29:40.493 | | 16 | 5 | 2019-08-16 21:29:40.490 | +----------+-------+-------------------------+