Which MySQL query should I use to get just rows repeated X times?
Example (stupid one ^^):
John likes apples.
Dave likes apples.
Bough likes bananas.
Light likes apples.
Wiky likes bananas.
I want a query that returns just fruits liked by 3 people (apples in my example). Cheers!
I want a query that returns just fruits liked by 3 people (apples in my example)
Try this:
SELECT fruit_name FROM `table` group by fruit_name having count(fruit_name)>=3;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With