Forums
This topic is locked
MS Access Count Query Returns 1 Instead of 0
Posted 22 May 2003 06:03:49
1
has voted
22 May 2003 06:03:49 Jeremy Kratz posted:
Hello all,I realize this isn't an Access forum, but I thought someone here might have some idea of what I can do here.
Basically, I'm attempting to add a comment count to a weblog system. I'm using an MS Access 2002 query to return a count of the comments that correspond to an article.
I've tried to come up with a way to display this count using Dreamweaver, but I run into problems because my articles are placed inside a repeat region. This is because my articles are in a different database table than the comments.
Here are some specifics for the database problem:
I'm having a problem with an Access 2002 query.
The database has 2 tables. One for articles, and one for comments about the articles. Each commment has a parent ID which is the same as one of the article IDs. The idea is that each Article can be selected, and then any comments about it are displayed with it.
Now I'd like to use a query to return the number of comments made on each article. I've set up a query to count the number of comments. Everything works great, except on articles that have no comments on them yet.
Under the Join Type, I've selected "2: Include ALL records from 'Articles' and only those records from 'Comments' where the joined fields are equal"
On the query spreadsheet view, any articles with no comments are given a Count of 1. It should be 0.
Articles that have 1 or more comments display the correct number with no problem.
Any ideas on how to get the Count to return 0 instead of 1?
By the way, I also tried changing the Join Type to "1: Only include rows where the joined fields from both tables are equal". This completely omits articles that have no comments from the resulting query spreadsheet view.
I'd appreciate any thoughts on this matter.
If anyone has any ideas on how to accomplish these same results using Dreamweaver, please let me know.