aumming query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am building a report that needs two display two specific numbers taht are
added up. these numbers ar both assiciated to the assigned account id.

I am having trouble getting both to work properly. here's an example.

Program account Activity
---------- -----------------
12 1 5
35 1 10
10 2 2
11 2 6

and i need the result to look like:

47 1 15
21 2 8


help!!!



thanks!
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

SELECT SUM(Program) As PgmSum, Account, SUM(Activity) As ActSum
FROM <table name>
WHERE <criteria>
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ9F0UYechKqOuFEgEQJfyACeKAiDbOzDsKBu8huZR6JEO55KWygAoNkh
aqXYd5a3aAa9YzQTihrGzAGC
=kcS6
-----END PGP SIGNATURE-----
 
MGFoster said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

SELECT SUM(Program) As PgmSum, Account, SUM(Activity) As ActSum
FROM <table name>
WHERE <criteria>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I always forget the GROUP BY....

SELECT SUM(Program) As PgmSum, Account, SUM(Activity) As ActSum
FROM <table name>
WHERE <criteria>
GROUP BY Account
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ9F0pIechKqOuFEgEQJ4FwCgsFMMl4IDn62eNgijD2n/R4HE4dEAoL3Q
wB6KP2S8rKJzHnI1OqsXwMTB
=JTbN
-----END PGP SIGNATURE-----
 
Back
Top