Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
dineshkumar.632
Starting Member
1 Post |
Posted - 2010-11-01 : 10:32:36
|
hai dear all, The query may be published but no one hepled me. I have one table name loginStatus. It contains three columns loginname, inTime, outTime .This table hold the the user's intime and outtime. the datatype of intime and outtime columns are datetime.
I want to retrieve first date and time from inTime column and last date and time from outTime on the particular date like '2010-09-03' Please give the sql query for this.
Thanks
dinesh |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-11-01 : 11:35:39
|
Try this: SELECT loginname, MIN(inTime) as firstInTime, MAX(outTime) as lastOutTime FROM loginStatus WHERE (inTime >= '20100903' and inTime < '20100904') AND (outTime >= '20100903' and outTime < '20100904') GROUP BY loginname
No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|