select Month(Logintime) as Month,Year(Logintime) as Year,ID as ID ,cast(Logintime as time) as LoginTime from UserLoginStatus where UserId=15 and Logintime IS NOT NULL
Month Year ID LoginTime
10 2014 4 15:05:10.5500000
10 2014 5 15:06:14.9170000
If i write above query i am getting the above result
But i need

Munesh SharmaRank #174 · 13.9K reputationPosted Oct 13, 2014, 2:25 AM EDT
Sasi ReddyRank #4,458 · 342 reputationPosted Oct 13, 2014, 2:32 AM EDT
Munesh SharmaRank #174 · 13.9K reputationPosted Oct 13, 2014, 2:42 AM EDT
SELECT * FROM UserLoginStatus where id IN(SELECT MAX(id) FROM UserLoginStatus )
Sasi ReddyRank #4,458 · 342 reputationPosted Oct 13, 2014, 2:44 AM EDT
Munesh SharmaRank #174 · 13.9K reputationPosted Oct 13, 2014, 2:47 AM EDT
you just put your table data i ll give u exact query..
Sasi ReddyRank #4,458 · 342 reputationPosted Oct 13, 2014, 2:51 AM EDT
4 15 2014-10-13 15:05:10.550 NULL
5 15 2014-10-13 15:06:14.917 NULL
615 NULL 2014-10-13 15:06:20.270
From above table i need lowest login time and highest logout time for the particular user based on userid and based on date
Munesh SharmaRank #174 · 13.9K reputationPosted Oct 13, 2014, 2:57 AM EDT
http://stackoverflow.com/questions/14193407/sql-server-get-min-time