I want to do something like this:
SELECT *
FROM db.table
WHERE COUNT(someField) > 1
How can I achieve this in MySql?
For me, Not having a group by just returned empty result. So i guess having a group by for the having statement is pretty important
You can also do this with a self-join:
SELECT t1.* FROM db.table t1
JOIN db.table t2 ON t1.someField = t2.someField AND t1.pk != t2.pk
SELECT username, numb from(
Select username, count(username) as numb from customers GROUP BY username ) as my_table
WHERE numb > 3