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 |
muyi
Starting Member
1 Post |
Posted - 2014-10-29 : 11:36:31
|
Hi, I have three different columns, hour(s), min(s), sec(s)I can add it up, but will like to convert it into. hrs, mins and sec.this is how, i am adding it up into seconds. SELECT ((TotalTimeSpentHrs*60*60)+(TotalTimeSpentMin*60)+(TotalTimeSpentSec))AS totaltimeFROM EST1how can I convert the total seconds, so that i can input the result in a new column. thanks |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2014-10-29 : 12:41:06
|
Don't you already have the hours, minutes, and seconds? Or are you trying to format it to some specific format?SELECT CAST([hour(s)] as varchar(32)) + ' Hour(s) ' + CAST([min(s)] as varchar(32)) + ' Min(s) ' + CAST([sec(s)] as varchar(32)) + ' Sec(s)' AS totaltimeFROM EST1 |
|
|
|
|
|