Multiple counts in a SQL statement Is it possible to have more than one count in a SQL statement such as:

SELECT 
    student_id, 
    (
        COUNT (ATTENDANCE_ID) 
        from attendance 
        where attendance_id IN ('ABSENT')
    ), 
    (
        COUNT (ATTENDANCE_ID) 
        from attendance 
        where attendance_id IN ('PRESENT')
    )
    FROM attendance;
COUNT counts values that are not NULL. You can transform the unneeded values into NULL for example with DECODE. Combining the two as below:

select
    student_id, 
    count(decode(attendance_id, 'ABSENT', 1, null)) as absent_count,
    count(decode(attendance_id, 'PRESENT', 1, null)) as present_count,
from
  attendance
group by
  student_id
;


Or you could put 0 instead of null and use SUM.