Reputation: 431
i have this database
i want to select options_e if it has options less than 4, or something like this
SELECT * FROM `options` WHERE count(qid) <4
so that it will return the result of options who are less than 4. but on phpmyadmin when i run the query, it says invalid use of group function. why do I get this error? who can i fix this?
Upvotes: 2
Views: 1326
Reputation: 172438
You can try like this:
SELECT options_e, options_f, options_p, options_a, options_s FROM `options`
GROUP BY options_e, options_f, options_p, options_a, options_s
HAVING count(qid) < 4
Upvotes: 2