Reputation: 93
I'm trying to understand COUNT(*), and therefore I created a testing query:
SELECT COUNT(*)
WHERE COUNT(UITLENINGEN.LLNR) >= 30;
When I click Execute, I get the following error:
Syntax error (operator missing) in query-expression COUNT(*) WHERE COUNT(UITLENINGEN.LLNR) >= 30.
What am I doing wrong?
Upvotes: 2
Views: 820
Reputation: 7822
Try this
SELECT COUNT(*) FROM UITLENINGEN GROUP BY LLNR HAVING COUNT(UITLENINGEN.LLNR) >= 30;
Upvotes: 1
Reputation: 97101
I don't understand what you're trying to do. The query below is based on a table which includes a field named category_id
. And it uses GROUP BY category_id
to count the number of rows within each such group. The HAVING
clause limits the result set to only those groups whose count is at least 30.
SELECT category_id, COUNT(*)
FROM YourTable
GROUP BY category_id
HAVING COUNT(*) >= 30;
If that is nothing like what you're trying to accomplish, please give us more detailed information so we may better understand your situation. A brief set of sample data, and the output you want based on that sample, would help tremendously.
Upvotes: 1
Reputation: 5588
Please, add table name and use having
statement where aggregation funcion required. E.g.:
select count(*)
from UITLENINGEN
having count(UITLENINGEN.LLNR) >= 30;
Upvotes: 0
Reputation: 1253
Add your table name to the query.
SELECT COUNT(*) FROM UITLENINGEN WHERE COUNT(UITLENINGEN.LLNR) >= 30;
Upvotes: 0
Reputation: 862
You have not specified the table from which the data should be retrieved. Try the following
SELECT COUNT(*) from tableName
WHERE COUNT(UITLENINGEN.LLNR) >= 30;
Upvotes: 0