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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Date/Time Conversion Help

Author  Topic 

deve
Starting Member

1 Post

Posted - 2006-08-31 : 08:17:55
Hi,

I have a table with 5 fields in it.
1) RecordId, PK
2) UserId, varchar
3) LoginDate, datetime
4) LogoutDate,datetime
5) SessionTime,int

I would like to calculate the time difference(in Mins) between field 3 and 4.

Any advice on what is the best practice to do it?

Thanks in advance,
Deve







SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-08-31 : 08:22:22
SELECT Table1.*, DATEDIFF(second, LoginDate, LogoutDate) / 60.0
FROM Table1


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -