289 views
5 votes
Use ONE SQL statement to show the total number of actual hours for each customer. In the output, show customer id and the total number of actual hours for each customer.

1 Answer

4 votes

Step-by-step explanation:

SELECT

distributor_id,

COUNT(*) AS TOTAL,

COUNT(IF(level='exec',1,null)),

COUNT(IF(level='personal',1,null))

FROM sometable;

User Jorvis
by
4.6k points