English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am managing a scholarship database. In it, there are student IDs. A scholarship is assigned to a student by semester, so if a student is here in the fall and spring semesters, they are entered twice in two different fields. I need access to count each student only ONE time. I am trying to use the count distinct function, but it is not working for me. My statement looks something like this:

SELECT Count (DISTINCT t_scholarship_offered.student_id)

I keep getting this error message: Syntax error (missing operator) in query expression 'Count (Distinct......)' What am I doing wrong? Thanks in advance!

2007-03-08 03:17:49 · 3 answers · asked by miss_fatbooty 2 in Computers & Internet Programming & Design

SELECT COUNT (Distinct student_id)

That is the jist of the statement that it keeps telling me there is an error in.

2007-03-08 03:37:58 · update #1

3 answers

This is commonly caused when some value that you are trying to SELECT/UPDATE etc contains a single quote mark. Using double ' might help. Remember for integer fields we don't use quotes at all.

Just to keep things clear the following statement works fine:
SELECT COUNT(DISTINCT city)
FROM authors

Hope this helps.

2007-03-08 10:42:26 · answer #1 · answered by Smutty 6 · 0 0

You need to post your entire code so we can see what the error may be. Count distinct should work fine once you get the syntax error worked out.

2007-03-08 03:27:45 · answer #2 · answered by Sane 6 · 0 0

pick count extensive kind(diverse(city)) as CountOfCity from shopper . in case you nevertheless get an errors, then it rather is recommend 'get entry to' did not help question like that. attempt to trick the database : create a 'VIEW' e.g. 'View_City' which contains : pick diverse city from shopper then make this question : pick count extensive kind(city) from VIEW_CITY

2016-12-18 08:29:00 · answer #3 · answered by ? 4 · 0 0

fedest.com, questions and answers