From: Michal Ludvig Date: March 20 1999 6:20pm Subject: Help with query, plz List-Archive: http://lists.mysql.com/mysql/689 Message-Id: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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