List:General Discussion« Previous MessageNext Message »
From:Ed Carp Date:March 20 1999 6:37pm
Subject:Re: Help with query, plz
View as plain text  
>> COUNT(DISTINCT(...)) doesn't work in MySQL (yet).  Try this:
>> 
>> SELECT COUNT(*) FROM table GROUP BY ip;
>
>It tells me how many times each IP is in the table, but that's not what I
>need. I need the count of >different< IPs.


How about

SELECT ip INTO temp_table
FROM table
GROUP BY ip
HAVING (((Count(ip))<>1));

SELECT Count(*) FROM temp_table;

The temp table will only have the non-unique ip's.


Thread
Help with query, plzMichal Ludvig20 Mar
  • Re: Help with query, plzThimble Smith20 Mar
    • Re: Help with query, plzMichal Ludvig20 Mar
    • Re: Help with query, plzMartin Ramsch20 Mar
Re: Help with query, plzEd Carp20 Mar
  • Re: Help with query, plzMichal Ludvig20 Mar
    • Re: Help with query, plzThimble Smith20 Mar
Re: Help with query, plzEd Carp20 Mar
  • Re: Help with query, plzMartin Ramsch20 Mar
Re: Help with query, plzEd Carp20 Mar