Error is
Unknown column \'num\' in \'where\' clause
SELECT COUNT(*) AS num, books_bookid
FROM bookgenre_has_books
WHERE
Try this, you should use the HAVING clause
SELECT COUNT(*) AS num, books_bookid
FROM bookgenre_has_books
GROUP BY books_bookid
HAVING COUNT(*) > 10
The SQL HAVING clause is used in combination with the SQL GROUP BY clause. It can be used in an SQL SELECT statement to filter the records that a SQL GROUP BY returns.