Solved

SELECT COUNT(DISTINCT Field) ... Not Working... What am I missing?

Posted on 2004-10-07
3
539 Views
Last Modified: 2008-01-16
Greetings All!

Here is the deal, I am trying to Count all of the unqiue groups in a table. I thought it should be as easy as :

SELECT COUNT(DISTINCT tGroup)as 'CNT' From Terms

I have checked a few other posts on here to confirm my syntax... unless I am overlooking a detail, it should be right.
This is the error I receive:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'COUNT(DISTINCT tGroup)'.

/inc/functions/dbConn.asp, line 10

Any ideas?
0
Comment
Question by:intreeg
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
tusharashah earned 500 total points
ID: 12251209
Try using this Query:

SELECT COUNT(*) as 'CNT'
FROM (SELECT DISTINCT tGroup FROM Terms)

-tushar
0
 
LVL 5

Author Comment

by:intreeg
ID: 12251282
Beautiful!!!!
BTW: I made an error to begin with there should be no ' ' around CNT ... just for reference for anyone looking for this solution!

Good Job tushar!
0
 
LVL 18

Expert Comment

by:tusharashah
ID: 12251304
Nice to have you going!

Thanks for A

-tusahr
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question