select * from 表 where year(日期字段)=1999 and month(日期字段)=12

解决方案 »

  1.   

    select * from table where to_char(日期字段,'yyyy-mm')='2000-10'
    这个就要求控制输入的日期格式
      

  2.   

    --或者:
    declare @年 int,@月 int
    select @年=1999,@月=11select * from  表 
    where 日期字段 between dateadd(month,@月-1,dateadd(year,@年-1900,'1900-1-1'))
     and dateadd(month,@月,dateadd(year,@年-1900,'1900-1-1'))-1