Select where count of one field is greater than one

后端 未结 9 1171
说谎
说谎 2020-12-07 23:57

I want to do something like this:

SELECT * 
  FROM db.table 
 WHERE COUNT(someField) > 1

How can I achieve this in MySql?

9条回答
  •  感情败类
    2020-12-08 00:16

    As OMG Ponies stated, the having clause is what you are after. However, if you were hoping that you would get discrete rows instead of a summary (the "having" creates a summary) - it cannot be done in a single statement. You must use two statements in that case.

提交回复
热议问题