Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-10-07
3
Medium Priority
?
543 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
tusharashah earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses

688 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