Forum Moderators: open

Message Too Old, No Replies

Query to SELECT.

If `ip` occurs more than once in table

         

ceil

9:03 am on Dec 9, 2006 (gmt 0)

10+ Year Member



How can I SELECT all the rows that occur when `ip` occurs more than once in that table?

aspdaddy

11:57 am on Dec 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I dont have a database to test but I think its something like this:

SELECT IP, count(IP)
FROM table
WHERE count(IP) >1
GROUP BY IP

OR
SELECT IP, count(IP)
FROM table
GROUP BY IP
HAVING count(IP) >1

ceil

3:47 am on Dec 12, 2006 (gmt 0)

10+ Year Member



SELECT IP, count(IP)
FROM table
GROUP BY IP
HAVING count(IP) >1

Worked

ceil

3:48 am on Dec 12, 2006 (gmt 0)

10+ Year Member



Thanks