| Author |
Topic |
|
manu
Starting Member
41 Posts |
Posted - 2005-10-19 : 08:24:38
|
| Dear Sir,i have a sql query. the output of query is result of 10 records and 5 fields,group by agent id(one of the field in table having 10 distinct agent id's)i want to have one more record for 5 aggregate values of 5 fields(i.e. 10 records and one record for aggregate of individual field having sum of 10 records for that field)Pls help meMunish Gupta |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-10-19 : 08:36:41
|
| can you post the samples.. data for the same.. so that we can work out with itComplicated things can be done by simple thinking |
 |
|
|
manu
Starting Member
41 Posts |
Posted - 2005-10-19 : 08:50:28
|
| sir,let my table is a b c d1001 4 5 61001 5 5 61002 5 8 8when i calculate sum group by athe result isa b c d1001 9 10 121002 5 8 8 i want one row for aggregate sum of b,c,d for all a's ie.e a b c d1001 9 10 121002 5 8 8 14 18 20Pls help me.. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-19 : 08:52:47
|
| Where do you want to show these data?Are you using Reports?MadhivananFailing to plan is Planning to fail |
 |
|
|
manu
Starting Member
41 Posts |
Posted - 2005-10-19 : 08:55:27
|
| yes sir exactly,i have time value fields. reporting is for callcenter.i need total login time for each user and total login for all users.(user is a field)Munish Gupta |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-19 : 08:59:14
|
| Cant you use Summary Function in Reports?Which Reporting Tool are you using?MadhivananFailing to plan is Planning to fail |
 |
|
|
manu
Starting Member
41 Posts |
Posted - 2005-10-19 : 09:10:01
|
| sir,i am using sql server 2000 as backend and asp for application programming.my problem is that calculations are on time field. my values are in secondsi have used convert(varchar(20), dateadd(s,sum(fields),108)) function for total time for each user.now i want to find totaltime for all users. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-19 : 09:16:12
|
Try thisYour Select QueryUnion AllSelect '',sum(b),sum(c),sum(d) from(Your Select Query) T MadhivananFailing to plan is Planning to fail |
 |
|
|
manu
Starting Member
41 Posts |
Posted - 2005-10-19 : 10:04:21
|
Thanks a lot sir,it is really working properlyit is really amazing for me. sir tell me one more thingis it possible to display the time for more than 24 hours.if i have time in seconds>86400 (i.e. more than 24 hours)and usingconvert(varchar(10),dateadd(s,86401,'19000101'),108) is it possible to display it as 24:00:01 once again a lot of thanksMunish Gupta |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|