I'm looking to display how many of the jobs in the job table that are being grouped by customer_id are approved. Approval is determined if approval_date is not null. So if there are 12 total jobs, I want to show that 7 are approved, for example. If the approval date is null, the job is not approved.
select
c.customer_name
,count(*) as counts
, -- i want to add a column here that tells me which jobs have (j.approval_date is not null)
from job j
join customer c on j.customer_id = c.customer_id
group by c.customer_name
The code below gives syntax error:
,count(approval_date is not null) as is_approved