-2

I have this query :

SELECT COUNT (DISTINCT Class)
    from student ;

I am getting :

syntax error(missing operator) in this query.

Mad Dog Tannen
  • 7,129
  • 5
  • 31
  • 55
  • 1
    MySql and ms-access are two very different systems. Which one are you using really? – Renzo Aug 30 '16 at 09:53
  • 1
    Sounds like ms-access : see this - http://stackoverflow.com/questions/11880199/how-do-i-count-unique-items-in-field-in-access-query – PaulF Aug 30 '16 at 09:55
  • I have found out the reason. This problem is arising because I am using MS-Access. – Anurag Mundra Aug 31 '16 at 12:11

1 Answers1

1

You are probably after this:

SELECT COUNT(*) As ClassCount
FROM (SELECT DISTINCT Class FROM student);

or:

SELECT COUNT(*) As ClassCount
FROM (SELECT DISTINCT Class FROM student) AS T;
Gustav
  • 53,498
  • 7
  • 29
  • 55