Question : Weird grouping query

I have three tables similar to these:

Store
----------
ID

Product1
-----------
StoreID
Date
Volume

Product2
-----------
StoreID
Date
Volume

I am trying to write a query that will end up with output like so:

StoreID, Date, Product1_Volume, Product2_Volume

(basically grouping the volumes by the StoreID and Date)

Any thoughts?

Answer : Weird grouping query

try this
1:
2:
3:
4:
5:
6:
7:
8:
select storeid, date, sum(product1_volume) as product1_volume, sum(product2_volume) as product2_volume
select p1.storeid, date, volume as product1_volume, null as product2_volume
from product1 as p1
union all
select p2.storeid, date, null, volume
from product2 as p2
) as products
group by storeid, date
Random Solutions  
 
programming4us programming4us