A
Alex
If we have a table named Table1:
Date Product Dollar
------------------------
1/2002 1 $100
2/2002 2 $55
3/2002 5 $40
4/2002 1 $15
5/2002 2 $100
1/2003 1 $20
2/2003 3 $50
3/2003 3 $45
4/2003 6 $30
5/2003 8 $10
What kind of query could I use to get:
Product 2002 2003
-------------------------
1 $115 $20
2 $155 $ 0
3 $ 0 $95
5 $ 50 $ 0
6 $ 0 $30
8 $ 0 $ 0
I'm trying to use the following:
SELECT Product, Sum(Table1.Dollar) As 2002,
Sum(Table1_1.Dollar) As 2003 FROM Table1, Table1_1
FROM Table1 INNER JOIN Table1 AS Table1_1 ON
Table1.Product = Table1_1.Product
WHERE ((Table1.Date >=#1/2002# AND Table1.Date <=#5/2002#)
AND (Table1_1.Date >=#1/2003# AND Table1_1.Date
<=#5/2003#))
GROUP BY Product,Table1.Date, Table1_1.Date;
I would appreciate if anybody could help me out.
Thanks
Date Product Dollar
------------------------
1/2002 1 $100
2/2002 2 $55
3/2002 5 $40
4/2002 1 $15
5/2002 2 $100
1/2003 1 $20
2/2003 3 $50
3/2003 3 $45
4/2003 6 $30
5/2003 8 $10
What kind of query could I use to get:
Product 2002 2003
-------------------------
1 $115 $20
2 $155 $ 0
3 $ 0 $95
5 $ 50 $ 0
6 $ 0 $30
8 $ 0 $ 0
I'm trying to use the following:
SELECT Product, Sum(Table1.Dollar) As 2002,
Sum(Table1_1.Dollar) As 2003 FROM Table1, Table1_1
FROM Table1 INNER JOIN Table1 AS Table1_1 ON
Table1.Product = Table1_1.Product
WHERE ((Table1.Date >=#1/2002# AND Table1.Date <=#5/2002#)
AND (Table1_1.Date >=#1/2003# AND Table1_1.Date
<=#5/2003#))
GROUP BY Product,Table1.Date, Table1_1.Date;
I would appreciate if anybody could help me out.
Thanks