Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    sql-statement...

    Hello!

    I have a general question about a sql-statement. I wonder if the following statement is a correct statement?

    SELECT personal.skiftlag, COUNT(merit.kurskod) AS res
    FROM personal INNER JOIN merit ON personal.anstnr = merit.anstnr
    WHERE merit.kurskod = 'B2-DM' AND skiftlag = 1;

    The problem seems to be that I can“t use COUNT together with anything else, if I do this everything works allright:

    SELECT COUNT(merit.kurskod) AS res
    FROM merit
    WHERE merit.kurskod = 'B2-DM';

    I am using an access 2000 database if that has anything to do with my problem. I have heard that access has certain limitations regarding sql.

    Thanks in advance

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    British Columbia
    Posts
    235
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The GROUP BY clause is often needed when using the COUNT() function.

  • #3
    New to the CF scene
    Join Date
    Oct 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    That was the trick!

    Hello Dylan!

    That was the trick. Now it work“s excellent.

    Thanks a lot!


  •  

    Posting Permissions

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