Hello,
I have following table with data.
service_id service_start service_end updated_by last_updated
----------- ----------------------- ----------------------- ---------- -----------------------
1 2010-06-30 00:00:00.000 2010-06-30 00:00:00.000 test 2010-06-09 14:45:31.367
2 2010-06-30 00:00:00.000 2010-06-30 00:00:00.000 test 2010-06-09 14:47:17.163
3 2010-07-31 00:00:00.000 2010-07-31 00:00:00.000 test 2010-06-09 14:49:16.210
4 2010-07-01 00:00:00.000 2010-07-01 00:00:00.000 test 2010-06-09 14:49:16.210
6 2010-07-01 00:00:00.000 2010-07-01 00:00:00.000 test 2010-06-10 14:49:16.210
7 2010-07-31 00:00:00.000 2010-07-31 00:00:00.000 test 2010-06-09 14:53:16.210
I would like to select distinct service_start with latest update. So when I do a select it should look like
service_id service_start service_end updated_by last_updated
----------- ----------------------- ----------------------- ---------- -----------------------
2 2010-06-30 00:00:00.000 2010-06-30 00:00:00.000 test 2010-06-09 14:47:17.163
6 2010-07-01 00:00:00.000 2010-07-01 00:00:00.000 test 2010-06-10 14:49:16.210
7 2010-07-31 00:00:00.000 2010-07-31 00:00:00.000 test 2010-06-09 14:53:16.210
When I tried a query "Select DISTINCT service_id, service_start, service_end, updated_by, last_updated from services order by last_updated desc" gives me all the records.
Thanks for help in advance.