I have the following query:
SELECT *
FROM
(
SELECT COUNT (APP_AUTOMATIC_NUMBER) AS RECORD_COUNT, LETTER_TYPE_ID,
TO_DATE (EXTRACT_DATE, 'MMDDYYYY') AS EXTRACT_DATE,
'Consumer' AS ACCT_TYPE
FROM [TABLE_NAME]
WHERE SUBSTR(EXTRACT_DATE, -4) = '2020' and EXTRACT_DATE between TO_CHAR( (sysdate - 6), 'MMDDYYYY' ) and TO_CHAR( (sysdate - 4), 'MMDDYYYY' )
GROUP BY CUBE (LETTER_TYPE_ID, EXTRACT_DATE)
) t
PIVOT(
SUM(RECORD_COUNT)
FOR LETTER_TYPE_ID IN (
1,10,11,12,13,14,4,7,9)
)
ORDER BY EXTRACT_DATE
It will return the results in the screenshot (see belwow) where it's totaling the column but I'd like to total over the row instead. So getting the total record count for each day instead ... and not showing the total by column at all.
This seems like a common issue however I'm crushed trying to search the internet for a straight forward answer.
