Count DISTINCT
- From: "Mary" <alan@xxxxxxxxx>
- Date: Wed, 26 Mar 2008 20:51:30 +0800
Hi,
I am using Access DB, and want to calculate how many member in my db.
MemberID
Alan
Peter
Carlie
Alan
Tam
SQL = "SELECT Count(MemberID) As DDD From Trans"
It returns 5
But I want the answer returns 4 because "Alan" is duplicate, then I use
DISINCT :
SQL = "SELECT Count(DISTINCT MemberID) As DDD From Trans"
it returns rs error
I try the following :
SQL = "SELECT DISTINCT MemberID From Trans" ---- its ok
I also try below :
SQL = "SELECT DISTINCT, Count(MemberID) As DDD From Trans"
SQL = "SELECT Count(MemberID, DISTINCT) As DDD From Trans"
SQL = "SELECT Count(DISTINCT, MemberID) As DDD From Trans".............over
hundred SQL or change the Db to digit, let say, 1;2;3;4;2;5 but no use.
Everything go wrong, I search through the web, many peoples said that it is
possible to use Count DISTINCT, but I really try many times, it is a very
simple DB, what wrong with me, can anyone tell me the that he can.
I really lost, thanks for help
.
- Follow-Ups:
- Re: Count DISTINCT
- From: Bob Barrows [MVP]
- Re: Count DISTINCT
- Prev by Date: RE: Initial Catalog SQL Connection String
- Next by Date: Re: Count DISTINCT
- Previous by thread: RE: Initial Catalog SQL Connection String
- Next by thread: Re: Count DISTINCT
- Index(es):
Relevant Pages
|
Loading