The code below is giving me the error:
column ‘id’ in field list is ambiguous.
I added the productr2011 to it and it started doing that. If I take out the product2011 from the query then it works just fine.
SELECT id, itemName, itemRUDate, Sum(itemsSold) AS SumOf
FROM productr
WHERE itemRUDate >= '2012/03/03' AND itemRUDate <= '2012/03/03'
GROUP BY itemName
UNION
SELECT id, itemName, itemRUDate, Sum(itemsSold) AS SumOf
FROM productr2010, productr2011
WHERE itemRUDate >= '2012/03/03' AND itemRUDate <= '2012/03/03'
GROUP BY itemName
ORDER BY SumOf DESC;
Why does it work with just the product2010 and not when it has product2010, product2011?
Update
I am just trying to combine old archive records to a search. Hints why I am adding all data from 2010 and 2011 (usually the query dates should be of 2011 and not 2012) :o)
You sure you want to do a join between
product2010andproduct2011? I am not sure about your exact requirement, but this maybe what you are looking for: