Miscellany
public text v1 · immutableSELECT DISTINCT a.job_id
FROM tbl_job_tag a
WHERE a.tag IN ('jobstate_accepted',
'jobstate_appointment',
'jobstate_inspected',
'jobstate_contacting',
'jobstate_typingoffice',
'jobstate_quote',
'jobstate_typingpool',
'jobstate_hold',
'jobstate_delay')
and a.job_id not in(
select DISTINCT job_id
from tbl_job_tag b
where b.tag in ('jobstate_cancelled',
'jobstate_draft',
'jobstate_logged',
'jobstate_queried',
'jobstate_complete')
);