Error is
Unknown column \'num\' in \'where\' clause
SELECT COUNT(*) AS num, books_bookid FROM bookgenre_has_books WHERE
We can write like this
SELECT COUNT(*) , books_bookid FROM bookgenre_has_books GROUP BY books_bookid having count(*) > 10
you are checking for duplicates more then for that column books_bookid