I have two tables from which I want the sum of the columns based on a common
key. From the below tables, the desired output is 3,5,1,2. Instead I get
6,10,6,3. I am sure the solution is simple, but I haven't run into this one
before and any help would be appreacited.
Gary
Table1
-------
TableID User Col1 Col2
1 Karl 1 0
2 Karl 0 2
3 Karl 2 3
Table2
-------
TableID User Col1 Col2
1 Karl 1 0
2 Karl 0 2
SQL Query
---------
SELECT Sum(a.Col1), Sum(a.Col2), Sum(b.Col1), Sum(b.Col2)
FROM Table1 a, Table2 b
WHERE a.User = b.User
AND a.User = 'Karl'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists