I have a table with millions of rows and 940 columns. I'm really hoping there is a way to summarize this data. I want to see frequencies for each value for EVERY column. I used this code with a few of the columns, but I won't be able to get many more columns in before the processing is too large.
SELECT
f19_24
,f25_34
,f35_44
,f45_49
,f50_54
,f55_59
,f60_64
,count(1) AS Frequency
FROM
(SELECT a.account, ntile(3) over (order by sum(a.seconds) desc) as ntile
,f19_24
,f25_34
,f35_44
,f45_49
,f50_54
,f55_59
,f60_64
FROM demo as c
JOIN aggregates a on c.customer_account = a.account
WHERE a.month IN ('201804', '201805', '201806')
GROUP BY a.account
,f19_24
,f25_34
,f35_44
,f45_49
,f50_54
,f55_59
,f60_64
)
WHERE ntile = 1
GROUP BY
f19_24
,f25_34
,f35_44
,f45_49
,f50_54
,f55_59
,f60_64
The problem is that the GROUP BY
will be far too cumbersome. Is there any other way??? It would be really helpful to be able to see where the high frequencies are in such a large dataset.