tbl_posting_job_info
tbl_company_info
company_id companyname
---------------------------
1 XYZ
4 PQR
8 LMN
现在我想要一个公司的信息,它甚至没有一个“活跃”的工作。
tbl_posting_job_info
tbl_company_info
company_id companyname
---------------------------
1 XYZ
4 PQR
8 LMN
现在我想要一个公司的信息,它甚至没有一个“活跃”的工作。
select *
from tbl_company_info c
where not exists
(
select *
from tbl_posting_job_info j
where j.company_id = c.company_id
and j.status = 'active'
)
select *
from tbl_company_info a
where Isnull((
select count(*)
from tbl_posting_job_info b
where a.company_id = b.company_id
and a.status = 'active'
),0) = 0