Results 1 to 5 of 5

Thread: another count problem

  1. #1
    Join Date
    Dec 2004
    Posts
    37

    another count problem

    When I try to count something and want the results to be displayed that are over 20 i use count(people)>20 but this brings up errors such as group function not allowed here and not a singlegroup group function.

    I was just wondering what would be causing those errors?

    Thanks in advance.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    You can't have a column in select statement that has group function like count and another column without any grouping function.

    Post your sql statement and I can point out what is causing the problem.

  3. #3
    Join Date
    Dec 2004
    Posts
    37
    An example would be:
    select employeeNo, name count(project.project#) "over 20 projects"
    from employee, project
    where employee.employeeNo=project.employeeNo and count(project.project#)>20;

    I want to be able to display the employees with over 20 projects.

    Any ideas where I would be going wrong?

  4. #4
    Join Date
    Nov 2002
    Location
    DE
    Posts
    246
    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
    Last edited by andi_g69; 01-07-2005 at 02:41 PM.

  5. #5
    Join Date
    Dec 2004
    Posts
    37
    I seem to have got that working but where I have the count project number instead of displaying say 21 it would display 210.

    Any idea why its doing that?
    Last edited by 182; 01-07-2005 at 06:14 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •