Link to home
Start Free TrialLog in
Avatar of shchuka
shchuka

asked on

count(distinct) in MS Access

I'm developing an application which is eventually to be ported into Oracle database,
but currently I'm doing debugging with MS Access, since it's easier to setup and verify
what's going on.  The problem I encountered is Access doesn't seem to understand
the count(distinct) in the query.  In particular, my query is

SELECT COUNT(DISTINCT VarMatrixRow) FROM DecVariables

When running this, I'm getting the error

Syntax error (missing operator) in query expression 'COUNT(DISTINCT VarMatrixRow)'

Of course, I can go around it and write a code to count the number of distinct things in the table,
but that's not very efficient, especially since I'll be moving this to Oracle soon.  Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of Anita030598
Anita030598

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shchuka
shchuka

ASKER

I knew about this one.  My idea is to do it in one query.  I need to do that 12 times in each iteration of a loop; the loop may iterate anywhere between 4 and 10 times, thus increasing the number of queries from potentially 120 to 240 - which is unacceptable in terms of performance.  Moreover, the

select count(x) from (select (distinct VarMatrixRow) x from DecVariables)

also fails in Access, since Access doesn't understand subqueries.

Thanks anyway.