sql - How to write select query for taken Lastupdated rows from table -
i new sql query can 1 know how last updated records table using sql query.
table schema:
user name | softwarename | publisher
scan time | user name | softwarename | publisher | installed date 08-05-2016 04:44:00 | yyy | msoffice | microsoft | 08-08-2016 09:34:00 pm 08-06-2016 12:12:00 pm | xxx | msoffice | microsoft | 08-08-2015 01:09:00 08-06-2016 12:52:00 pm| xxx | chrome | google | 08-07-2015 02:30:20 pm
last 2 rows updated 08-08-2016 need select query last updated records (08-08-2016)
you want records of last day. trim time part datetime casting date, order this, top 1 day ties , done:
select top 1 ties * mytable order cast([installed date] date) desc;
Comments
Post a Comment