I have the following SQL which works as SQL statment however it need to do a little bit more as mentioned below:
SELECT
Customer.Country, customer.[customer name], SUM(Orders.[Order Amount])AS [Sum Of Orders Placed]
FROM
Customer JOIN Orders ON customer.[Customer ID] = orders.[Customer ID]
GROUP by Customer.Country,customer.[customer name]
HAVING SUM(Orders.[Order Amount])>20000
ORDER BY Customer.Country ASC,customer.[customer name]ASC
BUT I want
HAVING SUM(Orders.[Order Amount])>
AVERAGE(HAVING SUM(Orders.[Order Amount]))
I want to pick customers who have ABOVE AVERAGE total SUM of orders placed grouped as above WITHOUT USING A VARIABLE.
Is it possible if so how?
Many thanks
SELECT
Customer.Country, customer.[customer name], SUM(Orders.[Order Amount])AS [Sum Of Orders Placed]
FROM
Customer JOIN Orders ON customer.[Customer ID] = orders.[Customer ID]
GROUP by Customer.Country,customer.[customer name]
HAVING SUM(Orders.[Order Amount])>20000
ORDER BY Customer.Country ASC,customer.[customer name]ASC
BUT I want
HAVING SUM(Orders.[Order Amount])>
AVERAGE(HAVING SUM(Orders.[Order Amount]))
I want to pick customers who have ABOVE AVERAGE total SUM of orders placed grouped as above WITHOUT USING A VARIABLE.
Is it possible if so how?
Many thanks