我有一个查询可以提取假期摘要信息。我想将结果限制为大于当前的周年日期。当我只使用周年纪念表达式来查询时,周年纪念表达式可以正常工作。当我输入 Where 子句时,它会提示周年纪念日。如果没有 Where 子句,则执行表达式并显示周年日期。
SELECT SchedulingLog.UserID, SchedulingLog.Category, Sum(IIf([CatDetail] Like 'Ann*',[Value],0)) AS Gain, Sum(IIf([CatDetail] Like '*Used*',[Value],0))+Sum(IIf([CatDetail] Like 'Adj*',[Value],0)) AS Used, [Gain]+[Used] AS [Left], Month([WM DOH]) & "/" & Day([WM DOH]) & "/" & Year(Date()) AS Anniversary
FROM SchedulingLog INNER JOIN Roster ON SchedulingLog.UserID = Roster.UserID
WHERE (((SchedulingLog.EventDate)>=[Anniversary]))
GROUP BY SchedulingLog.UserID, SchedulingLog.Category, Month([WM DOH]) & "/" & Day([WM DOH]) & "/" & Year(Date())
HAVING (((SchedulingLog.Category) Like "Vac*"));
我正在寻找的是一种将总和值限制在表达式周年纪念日之后的事件日期。
基于 Remous 对我的 SQL 缺乏经验和指导的耐心。我开始看到光明。所以当我拿
DateAdd("yyyy",1,[WM DOH])
it returns the individuals date of Hire and the year advances by 1.
ex. employee DOH 12-25-2003
The expression returns 12-25-2004
我正在将 dateAdd 调整为这样的东西
DateAdd("yyyy",Year(Date())-1,[WM DOH])
This returns something completely wrong. but illustrates what I am trying to accomplish
desired result ex. 12-25-2011
想法?