Okay guys here is the question. I have to list the department ID, department name, count of sales reps, and average commission rate for each department. Also I need to Group by
rewrite this way and see if it gives you what you want...
SELECT d.Dept_ID, d.Dept_Name,
Count(r.Sales_Rep_ID) NumOfSalesR,
c.Comm_Rate AVGCOM
FROM DEPT_arb d,
Join SALES_REP_arb r
On r.Dept_ID = d.Dept_ID
Join COMMISSION_arb c
On c.Comm_Class = r.Comm_Class
Group By d.Dept_ID, d.Dept_Name, c.Comm_Rate
Where c.Comm_Rate =
(Select AVG(Comm_Rate)
From COMMISSION_arb
Where Comm_Class = r.Comm_Class)
Order By c.Comm_Rate;