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, plz | Michal Ludvig | 20 Mar |
| • Re: Help with query, plz | Thimble Smith | 20 Mar |
| • Re: Help with query, plz | Michal Ludvig | 20 Mar |
| • Re: Help with query, plz | Martin Ramsch | 20 Mar |
| • Re: Help with query, plz | Ed Carp | 20 Mar |
| • Re: Help with query, plz | Michal Ludvig | 20 Mar |
| • Re: Help with query, plz | Thimble Smith | 20 Mar |
| • Re: Help with query, plz | Ed Carp | 20 Mar |
| • Re: Help with query, plz | Martin Ramsch | 20 Mar |
| • Re: Help with query, plz | Ed Carp | 20 Mar |