select k,count(*) from(
select a.key k,b.* from 表A a,(select * from 表B where to_date(submitTime,'yyyy-mm-dd hh24:mi') between to_date('2003-7-1 23:59','yyyy-mm-dd hh24:mi') and to_date('2005-1-1 23:59','yyyy-mm-dd hh24:mi') ) b where instr(b.msgContent,a.key)>0
) group by k;
没经过调试

解决方案 »

  1.   

    select count(*) from
    (select * from A
    where A.key in (select msgconent from B where to_char(submitTime,'yyyy.mm.dd)>'2002.07.01'
    and to_char(submitTime,'yyyy.mm.dd')<'2005.01.01');
      

  2.   

    select count(*) from
    (select * from A
    where A.key in (select msgconent from B where to_char(submitTime,'yyyy.mm.dd)>'2002.07.01'
    and to_char(submitTime,'yyyy.mm.dd')<='2005.01.01');
      

  3.   

    select count(*) from 
    (select b.* from a,b
     where to_date(b.submitTime,'yyyy-mm-dd hh24:mi') between to_date('2002-7-1 23:59','yyyy-       mm-dd hh24:mi') and to_date('2005-1-1 23:59','yyyy-mm-dd hh24:mi') 
      and  instr(b.msgContent,a.key)>0
    )