MSSQL Select Sum where Sum>X Problem
Posted on 2012-12-20
Will someone please show me how to structure the following SQL statement so that it will work? I do not know how to write it so that it pulls data where the sum of sales is greater than X.
SELECT crm_Customer_Employee_Assignments.CustomerNum, crm_customerPurchaseRollup.custLevel, sum(custsls.priceextension) as sales
LEFT OUTER JOIN CUSTSLS ON crm_Customer_Employee_Assignments.CustomerNum=CUSTSLS.CustNum
LEFT OUTER JOIN crm_customerPurchaseRollup ON crm_Customer_Employee_Assignments.CustomerNum = crm_customerPurchaseRollup.trueCustNum
WHERE SUM(CUSTSLS.PRICEEXTENSION)>=1.23 group by customernum