February 8, 2017 at 5:49 pm
I have a table where it has column ID ,startDate.and Type
I want to write a query that based on minimum timestamp I have to get ID .
Example of data -
ID StartDate Type
21 2016-08-07 21:31:59.727 Emp
22 2016-08-07 21:32:03.883 Emp
23 2016-08-07 21:32:07.930 Emp
24 2016-08-07 21:32:12.337 Emp
25 2016-08-07 21:32:15.977 Emp
26 2016-08-07 21:32:19.447 Emp
How to get ID based on min time stamp
February 8, 2017 at 11:49 pm
You've been here over 500 times and can't even post an answerable question with proper sample data??? Please read this article and repost.
February 9, 2017 at 4:41 am
SELECT TOP(1) ID
FROM YourTable
ORDER BY StartDate DESC;
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply