select b.MonthPayNo,b.EmployCode,a.EmployName,a.StationCode,d.StationName,c.DeptName,b.BasicPay,b.DutyAllow,b.Allowance,b.PerfPrix,b.Tax,b.AgainstPay,b.Annuity,b.Madicare,b.Loan,b.AbsencePay,b.PubDate,b.InDate,b.OprtrCode
from F_Employee_Tbl as a,P_MonthPay_Tbl as b,F_Dept_Tbl as c,F_Station_Tbl as d
where b.EmployCode=a.EmployCode and a.DeptCode=c.DeptCode and a.StationCode=d.StationCode
and datediff(day,PubDate,'2003-06-05')=0

解决方案 »

  1.   

    select b.MonthPayNo,b.EmployCode,a.EmployName,a.StationCode,d.StationName,c.DeptName,b.BasicPay,b.DutyAllow,b.Allowance,b.PerfPrix,b.Tax,b.AgainstPay,b.Annuity,b.Madicare,b.Loan,b.AbsencePay,b.PubDate,b.InDate,b.OprtrCode
    from F_Employee_Tbl as a,P_MonthPay_Tbl as b,F_Dept_Tbl as c,F_Station_Tbl as d
    where b.EmployCode=a.EmployCode and a.DeptCode=c.DeptCode and a.StationCode=d.StationCode
    and year(PubDate)=2003 
    and month(PubDate)=6 
    and day(PubDate)=5
      

  2.   

    datediff(day,PubDate,'2003-06-05')=0
    判断为同一天!
      

  3.   

    PubDate 与 2003.06.05 相差零天,即pubdate=2003.06.05
      

  4.   

    datediff(day,PubDate,'2003-06-05')=0
    函数判断PubDate和'2003-06-05'相差0天,也就是同一天
    DATEDIFF
    返回跨两个指定日期的日期和时间边界数。 语法
    DATEDIFF ( datepart , startdate , enddate )