2
votes

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?

5
Where is the table name?Codesen
The table name is UITLENINGEN, I put it in between the COUNT brackets.Tanno
SELECT COUNT(*) FROM UITLENINGEN WHERE COUNT(UITLENINGEN.LLNR) >= 30;Codesen

5 Answers

1
votes

Try this

SELECT COUNT(*) FROM UITLENINGEN GROUP BY LLNR HAVING COUNT(UITLENINGEN.LLNR) >= 30;
1
votes

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.

0
votes

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;
0
votes

Add your table name to the query.

SELECT COUNT(*) FROM UITLENINGEN WHERE COUNT(UITLENINGEN.LLNR) >= 30;
0
votes

Please, add table name and use having statement where aggregation funcion required. E.g.:

select count(*) 
from UITLENINGEN
having count(UITLENINGEN.LLNR) >= 30;