sqlite - SQL missing 0 values -
i have problem 1 query:
select first_name, last_name, count(scheduleevents.id) workers join scheduleevents on scheduleevents.worker_id = workers.id
this query result is: workers have events ( more 0) in scheduleevents table want workers 0 events too. left join don`t work , ifnull option how can resolve problem?
you can use left join, you're missing group result per worker;
select first_name, last_name, count(scheduleevents.worker_id) workers left join scheduleevents on scheduleevents.worker_id = workers.id group workers.id;
Comments
Post a Comment