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 |
|
nikoo56
Starting Member
26 Posts |
Posted - 2012-02-22 : 13:02:18
|
| I have a report that shows the query below as 2 column, columns are time formatted, means for example it shows as 2:30 and 4:20, I like to have a third column that shows the sum of this 2 columns how I can make it?(select top 1 convert(varchar,datediff(hour, p.dt_created, time_stamp))+':'+convert(varchar,datediff(Minute, p.dt_created, time_stamp)%60)from tblAdmRepChangeLog th (nolock) where th.stu_rec_num = p.stu_rec_num order by cl_id asc)[xfer_1_elapsed],AND(select top 1 ltrim(minutes/60) +':' + LTRIM(minutes%60) as Elapsedfrom (select top 2 datediff(minute, p.dt_created, time_stamp) as minutes,cl_id from tblAdmRepChangeLog th (nolock) where th.stu_rec_num = p.stu_rec_num order by cl_id asc) q1 order by cl_id desc) [xfer_2_elapsed], |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
nikoo56
Starting Member
26 Posts |
Posted - 2012-02-22 : 16:12:04
|
| with Sum I mean, for example 1 column return 2:30 and 1 column return 3:30, shows 5:50 as Sum. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
nikoo56
Starting Member
26 Posts |
Posted - 2012-02-23 : 17:50:52
|
| OK 4:20 + 2:30 = 6:50So I want to have a new column that shows 6:50. Or Any other sum of 2 column. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-23 : 18:03:52
|
quote: Originally posted by nikoo56 OK 4:20 + 2:30 = 6:50So I want to have a new column that shows 6:50. Or Any other sum of 2 column.
what if its 4:40 + 2:40?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|
|
|