select * FROM a.db WHERE datediff(month,登记日期,getdate())=0

解决方案 »

  1.   

    怎么通不过?
    Invalid use of keyword
    Token:month
      

  2.   

    select * from a.db where month(登记日期)<month(getdate()) 
                             and year(登记日期)<year(getdate())
      

  3.   

    select * FROM a.db WHERE 登记日期>=:d1 and 登记日期<:d2程序中:
     ParamByName('D1').AsDate := “当月一号”
     ParamByName('D2').AsDate := “下月一号”注:在 paradox 数据库,中没有提供太多的内建函数,这是你只有借助程序将其设计出来。
      

  4.   

    var yy,mm,dd :Word;
        StartDate,EndDate: TDateTime;
    begin
     DecodeDate(now,yy,mm,dd);
     dd:=MonthDays[IsLeapYear(yy),mm];// 当前年月的天数;
     StartDate:=EncodeDate(yy,mm,1); // 当前年月的第一天;
     EndDate:=EncodeDate(yy,mm,dd); // 当前年月的最后一天;
     Sql.Add('Select * from TableName Where Date>=StartDate and Date<=EndDate');
    end;
      

  5.   

    楼上的大虾一不小心:
    Sql.Add('Select * from TableName Where Date>=StartDate and Date<=EndDate');
    应为:
    Sql.Add('Select * from TableName Where Date>='+StartDate+' and Date<='+EndDate);
      

  6.   

    在Paradox表设计中将month定为第二索引,好象可以解决Invalid use of keyword
    Token:month 的问题。