p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   SQL Server 2000 (http://p2p.wrox.com/forumdisplay.php?f=20)
-   -   How to use the SUM Aggregate (http://p2p.wrox.com/showthread.php?t=57685)

gregalb May 9th, 2007 10:12 PM

How to use the SUM Aggregate
 
HI

I have a table (below)and would like to add (sum) COL_D where COL_E is the same.

Your help is appreciated.
Greg


COL_A COL_B COL_C COL_D COL_E
03710/030.00 2007 5/02/2007 107.34 2487832
03710/030.00 2007 5/03/2007 134.88 2498785
03710/030.00 2007 6/06/2006 0.01 2363813
03710/030.00 2007 20/12/2006 134.88 2474110
03710/031.00 2007 23/11/2006 505.3 2451972
03710/031.00 2007 23/11/2006 561.45 2451972
03710/031.00 2007 23/11/2006 617.59 2451972
03710/032.00 2007 14/09/2006 485.06 2420321
03710/032.00 2007 14/09/2006 538.9 2420321
03710/032.00 2007 14/09/2006 592.79 2420321
03710/033.00 2007 1/02/2007 134.94 2486569
03710/033.00 2007 1/03/2007 27.25 2497071
03710/033.00 2007 1/03/2007 141.43 2497071
03710/033.00 2007 1/08/2006 125.21 2390416
03710/033.00 2007 1/09/2006 134.94 2414429



happygv May 10th, 2007 01:19 AM

Is this what you are looking for?
Code:

Select Sum(Col_D), Col_E
GROUP BY Col_E

Cheers

_________________________
- Vijay G
Strive for Perfection


All times are GMT -4. The time now is 01:50 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.