This is my SQL statement:
SELECT
A.username,
A.logdate,
SUM(A.AMPCPUTIME) AS cpu,
SUM(A.TOTALIOCOUNT) AS totalIO,
COUNT(A.QUERYID) AS qrycount,
(cpu / b.total_CPU) * 100 AS cpu_threshold_percentage,
(totalIO / b.total_IOUsage) * 100 AS io_threshold_percentage,
(qrycount / b.QRY_count) * 100 AS qry_threshold_percentage
FROM
pdcrinfo.DBQLOGTBL_HST A
INNER JOIN
VT_BASELINE b ON A.username = b.username
WHERE
A.LOGDATE = DATE-1
AND A.username NOT IN ('tdstatsmgr', 'tdstatsmgr_ms', 'sysadmin')
GROUP BY
A.username, A.logdate;
I don't know which column I'm missing out in the group by section. I only have two non aggregated columns in the select section.