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 2005 Forums
 Transact-SQL (2005)
 How to get sum of the differences of datetime col

Author  Topic 

Alam Hammad
Starting Member

1 Post

Posted - 2014-12-30 : 04:41:09
The data is in the following format

Rowid UserID Name Model St_Date End_Date
6 5 hammadalam 1 2014-12-26 20:45:00 2014-12-27 21:56:00
7 5 hammadalam 2 2014-12-26 21:01:00 2014-12-26 21:55:00
9 5 hammadalam 3 2014-12-26 21:52:00 2014-12-26 21:53:00
10 5 hammadalam 4 2014-12-26 22:29:00 2014-12-26 22:32:00

Thanks & regards

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-12-30 : 09:51:07
select sum(datediff(day, st_date,end_date))
from mytable.
Go to Top of Page
   

- Advertisement -