I want to create a query that satisfies these criteria:
- It counts the number of distinct values for each column.
- It selects the top three columns that have the greatest number of distinct values.
- It counts the number of distinct values contained in the power set of those top three columns.
This is what I've got so far:
SELECT TOP(3) COUNT(DISTINCT column_name) AS some_alias FROM tablename
GROUP BY ~ ORDER BY count(*) asc
What is wrong with my query?