> > select distinct a.username, a.ip from users a, users b where a.ip=b.ip &&
> > a.username != b.username;
> > 
> Thanks!! Worked like a dream! I'm not quite sure why it knew to pull only
> ip's that are in there more than once though?
> 

Here's what it's doing.  It does a join on itself where the ip is the same but the 
usernames are different.  For any ip that only has one username, the join condition 
fails.  But there may be extra data from the join, so I do a distinct to clear that 
up.  Probably not the most efficient query in the world, but it should be fine if it's 
not done frequently, or there isn't much traffic on the table.

Hope that helps!

Steve Meyers



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to