我想返回当月和当年的所有申请日期。这一定很简单,但是我想不通。我知道当月有 2 个日期,当年有 90 个日期。右,左,外,内我都试过了,只是把代码扔在墙上,想看看什么会粘住,但都不起作用。我要么两列得到 2,要么两列得到 180。这是我最新的选择声明。
SELECT count(a.evdtApplication) AS monthApplicationEntered,
count (b.evdtApplication) AS yearApplicationEntered
FROM tblEventDates a
RIGHT OUTER JOIN tblEventDates b ON a.LOANid = b.loanid
WHERE datediff(mm,a.evdtApplication,getdate()) = 0
AND datediff(yy,a.evdtApplication, getdate()) = 0
AND datediff(yy,b.evdtApplication,getdate()) = 0