Unknown column error in this COUNT MySQL statement?

后端 未结 4 520
情书的邮戳
情书的邮戳 2021-01-20 01:11

Error is

Unknown column \'num\' in \'where\' clause

SELECT COUNT(*) AS num, books_bookid
FROM bookgenre_has_books
WHERE         


        
4条回答
  •  情书的邮戳
    2021-01-20 01:45

    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

提交回复
热议问题