Skip to content
Advertisement

Selecting values from different columns in rows with the same ID

I have a table called COURSE_SELECT that shows students and which online products they will be able to access, but each product is in a different row, even when each of them has their own column.

Table: COURSE_SELECT

The vendor needs me to send a CSV file with only one row per student, like this:

I have no idea how to accomplish this. Any guidance will be greatly appreciated.

Advertisement

Answer

Since Y is greater than N, I’d group by the StudentID and query the maximum of each product:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement