You could do the following: select host,count(*) as counthost from TABLE_HOST group by 1 having counthost = 1;
Which will list all the hosts with only 1 record.. Then get the "numrows" from that query to find uot how many there are.. Cheers, Andrew -----Original Message----- From: Mithun Bhattacharya [mailto:[EMAIL PROTECTED] Sent: Wednesday 11 June 2003 18:05 To: MySQL Mailing List Subject: Re: Group by and Count query What about SELECT COUNT(DISTINCT(host)) FROM TABLE_HOST WHERE path_a=""; Mithun Karl J. Stubsjoen wrote: > Hello, > I am trying to count the number of unique records that exist in my > database based on a given criteria. My table looks like this: > > TABLE_HOST > id > host > path_a > path_b > > > The field host will have duplicates like: > > myway.com > hisway.com > hisway.com > hisway.com > someway.com > someway.com > yourway.com > > The given criteria is: only count the records where path_a is blank > (path_a='') > > Here is the query I'd like to run (which fails - but is exactly what I > need for a query): select sum(count(host)) from TABLE_HOST where > path_a='' group by host > > This is the next query I tried... (nothing distinct about the result > of a > count) > select distinct count(host) from TABLE_HOST where path_a='' > > > So, is it possible to perform this query? > Karl > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]