View Full Version : sql-statement...

10-12-2002, 11:15 AM

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 :)

Dylan Leblanc
10-12-2002, 08:32 PM
The GROUP BY clause is often needed when using the COUNT() function.

10-13-2002, 11:11 AM
Hello Dylan!

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

Thanks a lot! :thumbsup: