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 |
eugz
Posting Yak Master
210 Posts |
Posted - 2009-07-21 : 14:32:05
|
Hi All.I have data type integer of columns Hours and Minutes. How to convert those ineger column to time and SUM those column?Thanks |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-07-21 : 14:42:17
|
Something like this?declare @table table (hours int, minutes int)insert into @tableselect 10,50 UNION ALLselect 8,25 UNION ALLselect 3,26 UNION ALLselect 4,52 UNION ALLselect 3,31 SELECT [Hours] = sum(t.hours)+ sum(t.minutes)/60,[minutes] = sum(t.minutes)%60 FROM @table tJim |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-07-21 : 14:42:43
|
SUM(60 * colHour + colMinute) AS TotalMinutes N 56°04'39.26"E 12°55'05.63" |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|