select count(1)from table1 a 
where not exists(select * from table2 b where b.num = a.num and  (b.content like 'aaa%' or b.content like 'bbb%') )

解决方案 »

  1.   

    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%'))
      

  2.   

    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%')))还是原来的简单