Answers for "multiple count in sql"

SQL
0

multiple count in sql

SELECT distributor_id,
    count(*) AS Total,
    sum(CASE WHEN inflevel = 'exec' THEN 1 ELSE 0 END) AS ExecCount,
    sum(CASE WHEN inflevel = 'personal' THEN 1 ELSE 0 END) AS PersonalCount
FROM yourtable
GROUP BY distributor_id
Posted by: Guest on April-05-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language