现在有一个记录表table,日期字段都是时间戳的   id  startMonth      endMonth   1  2009-02-00     2009-04-00
   2  2009-05-00     2009-07-00
 我现在要查询出 startMonth   大于 2009-01-00 endMonth 小于 2009-07-00 之间的id  ? 希望各位大大们帮帮忙 
 先谢了 
 感激不尽 

解决方案 »

  1.   

    select 
      id
    from
      [table]
    where
      startMonth>'2009-01-00'
    and
      endMonth <'2009-07-00' 
    ?
      

  2.   

    select id from [table] where startMonth>'2009-01-01' And endMonth<'2009-07-01'  
      

  3.   

    select id from [table] where startMonth>'2009-01-01' and endMonth<'2009-07-01'  --同时满足
    select id from [table] where startMonth>'2009-01-01' or endMonth<'2009-07-01' --满足其中一个 
      

  4.   


    select 
         [id]
    from
         [table]
    where
         startMonth>'2009-01-00'
    and
         endMonth <'2009-07-00'