Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Count(Distinct.....)

Status
Not open for further replies.

goterps1

Technical User
Sep 21, 2006
13
US
I'm recieving a missing operator error on the select statment when attempting to run the following sql. Can you help?

SELECT COUNT(DISTINCT [Fund 49].SSN) AS Expr1 INTO [Matching 49]
FROM [Fund 49], [Fund 83]
WHERE ((([Fund 49].SSN)=[Fund 83].SSN));
 
JetSQL lacks the Count(DISTINCT ...) syntax.
A workaround:
SELECT Count(*) AS DistinctCount
INTO [Matching 49] FROM (
SELECT DISTINCT A.SSN FROM [Fund 49] AS A INNER JOIN [Fund 83] AS B ON A.SSN = B.SSN
) AS D

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top