源语句
select * from news where DATE(adddate)='2011-04-20'新需求:
要查询2011-04-20 2011-04-15 2011-04-25 这三天的数据(日期可能不连续)

解决方案 »

  1.   

    select * from news where DATE(adddate) between 
    '2011-04-20' - INTERVAL 5 DAY and '2011-04-20' + INTERVAL 5 DAY
      

  2.   

    select * from news where DATE(adddate) in ('2011-04-20','2011-04-15','2011-04-25')
      

  3.   

    select * from news where DATE(adddate) between '2011-04-20' and '2011-04-25';
      

  4.   

    select * from news 
    where DATE(adddate)='2011-04-20'
    or DATE(adddate)='2011-04-15'
    or DATE(adddate)='2011-04-25'
      

  5.   

    ideasky (ideasky)
      '截至2011-04-27 10:56:54  用户结帖率78.73%   未结帖:57  当您的问题得到解答后请及时结贴.
    http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
    http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
    http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html8、如何给分和结贴?
    http://community.csdn.net/Help/HelpCenter.htm#结帖