Kurisvo
08-25-2011, 11:21 PM
Hey guys, I've tried playing around with something, and I can't find the answer.
I need a query to help me keep my site clean. It needs to look something like this:
SELECT * FROM 'table' WHERE 'id' is the same AND number of records > 3
So let's say my table looks like this:
ID NAME
1 John
1 James
1 Alex
2 Kira
2 Mike
2 Nancy
2 Elenora
3 Raymond
3 Taylor
--------------
Only ID 2 should be returned because it is the only ID with more then 3 records. I would just loop through with a mysqli_num_rows, but with the size of the table it takes way too long and it not a healthy way to do it.
Is it even possible to do this? I've tried google, but I can't find anything. I would appreciate any help. :)
I need a query to help me keep my site clean. It needs to look something like this:
SELECT * FROM 'table' WHERE 'id' is the same AND number of records > 3
So let's say my table looks like this:
ID NAME
1 John
1 James
1 Alex
2 Kira
2 Mike
2 Nancy
2 Elenora
3 Raymond
3 Taylor
--------------
Only ID 2 should be returned because it is the only ID with more then 3 records. I would just loop through with a mysqli_num_rows, but with the size of the table it takes way too long and it not a healthy way to do it.
Is it even possible to do this? I've tried google, but I can't find anything. I would appreciate any help. :)