I am trying to build an Access 2000 query where it gives me a count of all data values. My current query works where it gives me a count of what data values are in the database but need it to also show a count of 0 for data values that are not in database.
My values that can be entered in my database field (called rating) are:
If values 1 and 3 were in the database and values 2 and 4 were not, then my query results should show this:
My attempts:
Also tried this and still didnt work:
Results of my failed attempts:
I need it to also show values 2 and 4 where the count is 0 but cant figure out how to do this:
Please advise.
My values that can be entered in my database field (called rating) are:
Code:
1
2
3
4
If values 1 and 3 were in the database and values 2 and 4 were not, then my query results should show this:
Code:
Exp1000 MyCount
1 18
2 0
3 23
4 0
My attempts:
Code:
SELECT rating,count(*) AS MyCount
FROM myTable
GROUP BY [rating];
Code:
SELECT iif((rating > 0),rating,'0'), count(*) AS MyCount
FROM myTable
GROUP BY [rating];
Results of my failed attempts:
Code:
Exp1000 MyCount
1 18
3 23
I need it to also show values 2 and 4 where the count is 0 but cant figure out how to do this:
Code:
Exp1000 MyCount
1 18
2 0
3 23
4 0
Please advise.