-
queries help
Hi, I was wondering when i use the count function why instead of 21 i would get 210 etc?
Thanks.
Last edited by 182; 01-09-2005 at 06:36 PM.
-
count returns the number of rows in your query.
maybe, supply the query here
-
I don't have the query with me now but it is similar to:
select employeeNo, name, count(project.project#) "over 20 projects"
from employee, project
where employee.employeeNo=project.employeeNo
group by employeeNo, name
having count(project.project#)>20
The problem seems to happen for all the projets that have been counted.
-
yup,
you are counting the number of rows that satisfy the WHERE condition.
-
So then why is it adding the extra zero to the numbers?
-
no adding of zero.
you have 210 rows that match the criteria of the where clause.
-
Something else must be wrong then because I shouldn't have that it should be 21.
Thanks for the help though.
Last edited by 182; 01-09-2005 at 08:05 PM.
-
issue the query without the COUNT function, the GROUP BY clause, and the HAVING clause.
then tell me how many rows you get.
if you need me to give you an example of what is happening, just say so
-
Ok I will give it a go and see where I am going wrong thanks for the advice
-
May be you should look at SELECT COUNT(DISTINCT fieldName) FROM tableName WHERE optionalClause;
-
Or maybe post your actual query.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|