Forum Discussion
Clayton_cramer
Jan 26, 2021Copper Contributor
Inserting empty rows
This should be simple, but my SQL skills are rusty. I have a query that extracts the year and a count of incidents from a table. SELECT year, Count(year) AS incidents FROM Table2 WHERE ((Table2....
- Feb 04, 2021
Clayton_cramer If you don't like IIF, then use IN:
SELECT year, Abs(Sum([cause_ID] In (15, 16))) AS incidents FROM Table2 GROUP BY year;
Clayton_cramer
Feb 02, 2021Copper Contributor
IIF needs an expression and two values for TRUE and FALSE evaluations of the expression. It should return a single VALUE and SUM should add all those values for all rows. What you provided makes perfect sense--except to Access, which is still complaining about wrong number of arguments. It is almost like IIF does not recognize that expression.
Gustav_Brock
Feb 04, 2021Iron Contributor
Clayton_cramer If you don't like IIF, then use IN:
SELECT
year,
Abs(Sum([cause_ID] In (15, 16))) AS incidents
FROM
Table2
GROUP BY
year;
- Clayton_cramerFeb 04, 2021Copper Contributor
Gustav_Brockperfect!