某表3字段URL--------createDate-----------LastUpdatec字段 部分时间是2009-1-7l字段 也有部分时间是2009-1-7查的是 把 c l 2个字段都是2009-1-7时候的URL数据 4W多我的SQL是
select URL from tbName a
where exists (select null from tbName b where date_format(a.createDate,'%Y-%m')=date_format(b.LastUpdate,'%Y-%m') and date_format(a.createDate,'%Y-%m')='2009-01' and date_format(b.LastUpdate,'%Y-%m')='2009-01');按要求的话 错 错在哪里?我运行错是没报 就是到现在都没出结果  提高速度的话  该怎么改  或者加索引的话 哪加?

解决方案 »

  1.   

    哎...............现实派的...
    ----URL----------------C-----------L
    www.sina.com------2009-1-7-----2009-1-7www.yahoo.com-----2008-1-7-----2009-1-7www.163.com-------2008-10-7-----2009-1-7
    c 和l 相同的 相关URL  就sina一个那结果就是url
    www.sina.com
      

  2.   

    C、L字段类型是否一致?
    如是
    select URL from tt where c=l and c='2009-1-7'
      

  3.   


    select *
    from tbName 
    where c=l