Question: SELECT e . empname, COUNT ( * ) AS 'Days Exceeding Average' FROM slsemp e JOIN ( SELECT empID, SalesDate, SUM ( Qty ) AS

SELECT e.empname, COUNT(*) AS 'Days Exceeding Average'
FROM slsemp e
JOIN (
SELECT empID, SalesDate, SUM(Qty) AS 'Total Quantity'
FROM slstrasx
GROUP BY empID, SalesDate
) t ON e.empID = t.empID
JOIN (
SELECT AVG(Qty) AS 'Avg Quantity'
FROM slstranx
) a
WHERE t.'Total Quantity' > a.'Avg Quantity'
GROUP BY e.empname;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!