You need to account for different values using a composite primary key
I need to create a report that displays the name of different locations, as well as the number of unique course offerings in those locations. The report should only indicate the city and number. unique course offers and sorted by the largest number of unique offers. The problem I am having is this offer table contains a composite primary key (suggesting start date and course code)
I run this SQL query and an error occurs as you cannot count multiple columns. But I'm not sure how to split the bill.
SELECT
offlocation AS city, COUNT(distinct offbegindate,crscode) as no. of unique course offerings
FROM
offering
GROUP BY offlocation
ORDER BY COUNT(distinct offbegindate,crscode) as no. of unique course offerings DESC;
Any help would be greatly appreciated.
+3
source to share