select count(1) from table1 a where not exists (select 1 from table2 a where num=a.num and (content like 'aaa%' or content like 'bbb%'))
select count(1)from table1 a where exits (select num from table1 where num not in (select num from table2 a where (content like 'aaa%' or content like 'bbb%')))还是原来的简单
count(1)
from
table1 a
where
not exists (select
1
from
table2 a
where
num=a.num
and
(content like 'aaa%'
or
content like 'bbb%'))
where exits (select num from table1 where num not in (select num from table2 a where (content like 'aaa%' or content like 'bbb%')))还是原来的简单