List:General Discussion« Previous MessageNext Message »
From:Michal Ludvig Date:March 20 1999 6:20pm
Subject:Help with query, plz
View as plain text  
Hi,
I have (maybe) a stupid question about a SQL query. I have a table with
column 'ip' which contains dozens of ip addresses converted to 4-byte form
and I'd like to know how many _different_ IPs are there. I've tried a lot
of variations of "SELECT COUNT(DISTINCT(ip)) FROM table" but couldn't find
the right one :-( Now I'm counting it via another table: 
INSERT INTO tabtmp SELECT DISTINCT ip FROM table
and then querying that new table:
SELECT COUNT(ip) FROM tabtmp
but since the 'table' usually contains about 2*10^6 records it is very
time consuming to create and drop the 'tabtmp'.

Could anyone help me, please?
Thanks
Michal Ludvig

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