How to sum sales values from different tables and group by sales rep
-
Wednesday, December 12, 2012 4:44 PM
I have 3 sales tables, we'll call them SalesA, SalesB and SalesC. In each of those tables, there is a field labeled [Sales Rep ID] that then has a relationship with a SalesRep table.
I want to sum all of the sales data in those 3 tables but I do not want to return a Sales Rep if they have no sales data. How would I write such a query?
All Replies
-
Wednesday, December 12, 2012 5:34 PMModerator
I think you need to create a UNION ALL query between these tables and then SUM the Sales based on the [Sales Rep ID] column.For every expert, there is an equal and opposite expert. - Becker's Law
My blog- Proposed As Answer by SQL Novice 01 Wednesday, December 12, 2012 5:41 PM
- Marked As Answer by JonnyBravoII Wednesday, December 12, 2012 6:12 PM
-
Wednesday, December 12, 2012 6:12 PMThat did the trick. Thanks much.

