Select * From TableName
Where Datepart(mm, Field1)= 4 
//查出4月份的数据~~~~~~~~~

解决方案 »

  1.   

    使用sql server的日期函数,year,month
      

  2.   

    select * from yourtable where DATEPART ( mm, datetimefield ) = month
      

  3.   

    or 
    select * from yourtable where MONTH(datetimefield ) = month
      

  4.   

    or 
    select * from yourtable where MONTH(datetimefield ) = month
      

  5.   

    select * from yourtable where mm >= monthdate AND mm <= monthdate
      

  6.   

    Datepart(mm, Field1)= 4 
    MONTH(datetimefield ) = month
    都会把不同年的数据放在一起.最好:
    select * from yourtable where datetimefield>= '2002-4-1' AND datetimefield <'2002-5-1'
    这样效率也高些
      

  7.   

    Datepart(mm, Field1)= 4 
    MONTH(datetimefield ) = month
    都会把不同年的数据放在一起.最好:
    select * from yourtable where datetimefield>= '2002-4-1' AND datetimefield <'2002-5-1'
    这样效率也高些
      

  8.   

    Datepart(mm, Field1)= 4 
    MONTH(datetimefield ) = month
    都会把不同年的数据放在一起.最好:
    select * from yourtable where datetimefield>= '2002-4-1' AND datetimefield <'2002-5-1'
    这样效率也高些
      

  9.   

    有month函数啊!
    select * from yourtable where month(field)=5