Access SQL Help

  • Thread starter Thread starter TBone
  • Start date Start date
T

TBone

Access comes with a sample database called - Northwinds.
I am taking a database class and one of my homework
problems is to write an SQL statement for this
problem "How many different countries do we ship to?" We
are to write these queries free style SQL and not using
the Access SQL Query tool.

I thought the query should be but I get an error message.
SELECT COUNT (DISTINCT Country)
FROM Customers;

The error is "syntax error (missing operator) in query
expression ..."
 
JET (the default database engine for Access) does not handle Count Distinct
this way.

You need to create a SubQuery, something like:

SELECT Count([Country])
FROM
( SELECT DISTINCT [Country]
FROM Customers
)
 
Back
Top