Ok here's another query question and set of data.
Table1
ID | DATE
2004-0001 | 2010-01-26
2004-0001 | 2010-01-26
TABLE2
ID | SALES
2004-0001 | 1000
2004-0001 | 3000
What I want to do there is just combine them and later the second query is display the sum of sales.
So in my first query wherein combining them this is how I done it.
The only problem that I encountered there is that it displays 4 data, which is wrong.Code:SELECT A.ID, A.DATE, B.SALES FROM TABLE1 A INNER JOIN TABLE2 B ON A.ID = B.ID
ID | DATE | SALES
2004-0001 | 2010-01-26 | 1000
2004-0001 | 2010-01-26 | 3000
2004-0001 | 2010-01-26 | 1000
2004-0001 | 2010-01-26 | 3000
Any corrections in my query. The result should be:
ID | DATE | SALES
2004-0001 | 2010-01-26 | 1000
2004-0001 | 2010-01-26 | 3000
Help here. For the second query question which is displaying the sum I think I can figured it out If I can get this first query.




Reply With Quote