The requirement is a big vague one, but I will count SUM line by line and <> 30. This is different from the answer to the question.
SELECT
SelectCol1, SelectCol2, SelectCol3, ..., SUM(AggregateCol)
FROM
Table
GROUP BY
SelectCol1, SelectCol2, SelectCol3, ...
HAVING
SUM(AggregateCol) <> 30
source
share