I have two tables, Import and Export, looking like this; Import Date | Shoe Style | Shoe Color | Quantity | ------------|------------|------------|----------| 11/20/2003 | A2003B | Red | 100 | 11/19/2003 | A2003B | Red | 20 | 11/20/2003 | A2005B | White | 80 | 11/20/2003 | A2003B | Red | 100 | 11/20/2003 | A2003B | Green | 100 | AND Export Date | Shoe Style | Shoe Color | Quantity | ------------|------------|------------|----------| 11/20/2004 | A2003B | Red | 100 | 11/19/2004 | A2003B | Red | 100 | 11/20/2005 | A2005B | White | 80 | 11/20/2005 | A2005B | White | 100 | 11/20/2004 | A2003B | Blue | 100 | This is what I need; Import Date | Shoe Style | Shoe Color | Quantity | ------------|------------|------------|----------| 11/20/2003 | A2003B | Red | 220 | 11/20/2003 | A2005B | White | 80 | 11/20/2003 | A2003B | Green | 100 | Next to.. Export Date | Shoe Style | Shoe Color | Quantity | ------------|------------|------------|----------| 11/20/2004 | A2003B | Red | 200 | 11/20/2005 | A2005B | White | 180 | 11/20/2004 | A2003B | Blue | 100 | Any suggestions?
SELECT Import_Date,Shoe_Style,Shoe_Color,SUM(Quantity) SUM_Quantity FROM ((SELECT * FROM Import) UNION ALL (SELECT * FROM Export)) A GROUP BY Import_Date,Shoe_Style,Shoe_Color ORDER BY Shoe_Style,Import_Date; Code (markup):
OK, try this: SELECT Import_Date,Shoe_Style,Shoe_Color,SUM(Quantity) SUM_Quantity FROM ((SELECT Import_Date,Shoe_Style,Shoe_Color,Quantity FROM Import) UNION ALL (SELECT Import_Date,Shoe_Style,Shoe_Color,Quantity FROM Export)) A GROUP BY Import_Date,Shoe_Style,Shoe_Color ORDER BY Shoe_Style,Import_Date; Code (markup): Check your exact column names and paste the errors if any. Regards
Thanks for wanting to help but I still get the syntax error. Please try it for yourself and see what error you get, maybe that way it is more clear to you what error I get.
I will take any other suggestions if anyone has any???? I am simply trying to see the number of quantities of the shoes exported and to see if those shoes were ever imported and if so how many were imported, so I will need a table with the following headers; Import Date | Import Color | Import Style | Import Qty | Export Date | Export Color | Export Style | Export Qty ------------|-------------|-------------|------------|------------|-------------|-------------|------------