It's still not quite doing what I want. I only want a list of IP's where there are more than 1 instance of an ip--and then display each of the multiple occurrences of the single ip (and repeat for each ip which has more than 1 occurrence)..
The queries are all so close, but, don't give what I want :( David ----- Original Message ----- From: "Steve Meyers" <[EMAIL PROTECTED]> To: "David Wolf" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, October 24, 2001 2:38 PM Subject: RE: Query help... I think you're looking for: SELECT username, ip, count(*) FROM users GROUP BY 1, 2 Steve Meyers > -----Original Message----- > From: David Wolf [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, October 24, 2001 12:21 PM > To: [EMAIL PROTECTED] > Subject: Query help... > > > I'm trying to come up with a query to do the following... I'm not having > lots of luck :( > > The table is a user database. The columns I'm interested in are: username, > lastip. I'm interested in pulling information out that would show > usernames > for each IP that appears more than once in the database.. i.e. > > username ip > persona 1.1.1.1 > personb 1.2.3.4 > personc 1.1.1.1 > > I'd be interested in seeing persona and personc (both have 1.1.1.1 ip's) > > I've tried.. > > SELECT lastip,count(*) FROM users GROUP BY lastip; > > but that only gives me an unordered list of the # of times an IP is used.. > > SELECT distinct(count(*)) FROM users GROUP BY lastip; > > but that doesn't join the info -- nor give me the ip's -- just frequency > (when I add 'lastip' to the select I get an error) > > I'm thinking that I'm going about this the wrong way.. But, I can't quite > get a clue. > > Can anyone help me out here? > > Thanks! > > David Wolf > > > > --------------------------------------------------------------------- > 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 > > --------------------------------------------------------------------- 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 --------------------------------------------------------------------- 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