我使用了以下代码
SELECT COUNT(*) AS [Total Promotions Before 2015] FROM [Employment History]
WHERE IIF([Date of 1st Promotion]<#1/1/2015#,1,0)
OR IIF([Date of 2nd Promotion]<#1/1/2015#,1,0)
OR IIF([Date of 3rd Promotion]<#1/1/2015#,1,0)
OR IIF([Date of 4th Promotion]<#1/1/2015#,1,0)
OR IIF([Date of 5th Promotion]<#1/1/2015#,1,0)
;
然而,这只能告诉我2015年之前有促销活动的人数,而不是促销本身的数量。 有没有办法让这更像 如果在第1年晋升,则计算+1 如果在第二年等,则+1;
答案 0 :(得分:1)
这是你想要的吗?
www.example.com/index.php?series=users
但我认为你真的想要:
SELECT COUNT(*) AS [Total Promotions Before 2015]
FROM [Employment History]
WHERE [Date of 1st Promotion] < #1/1/2015# OR
[Date of 2nd Promotion] < #1/1/2015# OR
[Date of 3rd Promotion] < #1/1/2015# OR
[Date of 4th Promotion] < #1/1/2015# OR
[Date of 5th Promotion] < #1/1/2015#;