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 SharmaPosted Oct 13, 2014, 6:57 AM
http://stackoverflow.com/questions/14193407/sql-server-get-min-time
Sasi ReddyPosted Oct 13, 2014, 6:51 AM
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 SharmaPosted Oct 13, 2014, 6:47 AM
you just put your table data i ll give u exact query..
Sasi ReddyPosted Oct 13, 2014, 6:44 AM
Munesh SharmaPosted Oct 13, 2014, 6:42 AM
SELECT * FROM UserLoginStatus where id IN(SELECT MAX(id) FROM UserLoginStatus )
Sasi ReddyPosted Oct 13, 2014, 6:32 AM
Munesh SharmaPosted Oct 13, 2014, 6:25 AM