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 |
|
rn5a
Starting Member
25 Posts |
Posted - 2008-10-13 : 07:43:39
|
| A SQL Server DB table has a column named Duration whose datatype is varchar. Assume that 3 records under this column are (in hours & minutes) 25:30, 31:30, 16:00. The sum of these 3 records should give me 73:00 i.e. 73 hours & 00 minutes. How do I find the sum?I could manage to get the hours using this query:select sum(cast(substring(Duration, 0, charindex(':',Duration)) as int)) as hours from table1Thanks,Ron |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|
|