Postgresql – order of execution confusion
SELECT First_name,last_name,email,ROUND (AVG(Amount),2) AS moneyspent FROM Customer INNER JOIN Payment ON Customer.customer_id= Payment.customer_id WHERE Staff_id=2 GROUP BY First_name,last_name,email HAVING SUM(Amount)>100 ORDER BY Moneyspent DESC first_name last_name email moneyspent Brittany Riley [email protected] 5.83 Arnold Havens [email protected] 5.14 Eleanor Hunt [email protected] 5.04…