Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
select filedate, switchcode, legaport,sum(legatime)/60 as minutes,count(*) as noofcalls from ABCwhere legaport like 'dac%' and filedate like '2008-08-04' group by filedate, switchcode,legaport order by filedate, switchcode,legaportwe will get result in below format. But we need one more column that is D2/E2 and all the records are to be sorted by ACD (column F) A B C D E F1 filedate switchcode legaport minutes noofcalls ACD2 4/8/2008 101 dac00:01 261 131 3 4/8/2008 101 dac00:02 276 121 4 4/8/2008 101 dac00:03 284 150 5 4/8/2008 101 dac00:04 251 170 6 4/8/2008 101 dac00:05 273 176 7 4/8/2008 101 dac00:06 259 173 8 4/8/2008 101 dac00:07 276 112 9 4/8/2008 101 dac00:08 319 117
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2008-09-19 : 09:39:16
what's ACD? you've not included it among select list.May be this is what you want
select filedate, switchcode, legaport,sum(legatime)/60 as minutes,count(*) as noofcalls,ACD,D2/E2 from ABCwhere legaport like 'dac%' and filedate like '2008-08-04' group by filedate, switchcode,legaport,ACD,D2,E2 order by filedate, switchcode,legaport,ACD