Solved

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

Posted on 2004-10-07
3
531 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Element alignment and word wrapping 9 61
Stupid git question 2 62
Standard for Web Development 3 27
Best practice for a landing page 3 44
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

910 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now