I'm a bit rusty in writing SQL Queries, I'm trying to output a list of 'Contacts' with no 'PAs'
select a.first_name, a.last_name, (select count(b.contact_id)) as "PA Count"
from CRM_Contact a left join CRM_PA b on a.id = b.contact_id
where [PA Count] = 0
group by a.first_name, a.last_name
Could someone explain why I am getting the error message:
Invalid column name 'PA Count'.
WHERE, you need to useHAVING