I want to know only the totals which are bigger than 1 therefore I wrote this query, but I don't know how to check if the total sum is bigger than 1. The SQL-Code:
SELECT P.Customer, COUNT(*) as TOTAL
FROM Projects P
WHERE total > 1
GROUP BY P.Customer
CodePudding user response:
SELECT P.Customer, COUNT(*) as TOTAL
FROM Projects P
GROUP BY P.Customer
HAVING SUM(total) > 1
CodePudding user response:
Instead of WHERE
you can use HAVING
:
SELECT P.Customer, COUNT(*)
FROM Projects P
GROUP BY P.Customer
HAVING COUNT(*)>1