select * from table where year(indate)=2002 and month(indate)=7

解决方案 »

  1.   

    iYear = 2002
    iMonth = 7SQLText = "Select * From 表 Where date between #" & Str(iYear) & "-"
    & Str(iMonth) & "-1# And " & Str(iYear) & "-" & Str(iMonth+1) & "-1#-1" 
      

  2.   

    select * from tablename where year(indate)=2002 and month(indate)=7
      

  3.   

    可以使用组合字符串:date1=变量(年) & "-" & 变量(月)& "-" & "1",date2=变量(年) & "-" & 变量(月)& "-" & "31",
    SQL语句如下:
    Select * From 表 Where indate Between date1 And date2