Inconsistent capitalisation of function names.
In this example, the two SUM functions don't have the same capitalisation.
SELECT
sum(a) AS aa,
SUM(b) AS bb
FROM foo
Make the case consistent.
SELECT
sum(a) AS aa,
sum(b) AS bb
FROM foo