Skip to content
Advertisement

get both the total count of enrollments and the count of sigtrack enrollments in one query

I have a table with following schema:

Column      Type   Description
user_id     INT    A unique identifier for a student.
session_id  INT    A  unique identifier for a course.
is_sigtrack CHAR   Identifies whether the enrollment is paid (sigtrack) or free. Values 'Y' or 'N'

I am trying to get both the total count of enrollments and the count of sigtrack enrollments in one query?

Advertisement

Answer

You could use conditional aggregation and count

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