Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-12-2002, 11:15 AM   PM User | #1
doktorn
New to the CF scene

 
Join Date: Oct 2002
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
doktorn is an unknown quantity at this point
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
doktorn is offline   Reply With Quote
Old 10-12-2002, 08:32 PM   PM User | #2
Dylan Leblanc
Regular Coder

 
Join Date: Sep 2002
Location: British Columbia
Posts: 235
Thanks: 0
Thanked 0 Times in 0 Posts
Dylan Leblanc is an unknown quantity at this point
The GROUP BY clause is often needed when using the COUNT() function.
Dylan Leblanc is offline   Reply With Quote
Old 10-13-2002, 11:11 AM   PM User | #3
doktorn
New to the CF scene

 
Join Date: Oct 2002
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
doktorn is an unknown quantity at this point
That was the trick!

Hello Dylan!

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

Thanks a lot!
doktorn is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:02 AM.


Advertisement
Log in to turn off these ads.