List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:June 25 2000 4:10am
Subject:Re: counting distinct entires in a DISTINCT row query.
View as plain text  
At 10:06 PM -0300 06/24/2000, Nasir Ali wrote:
>Hi folks!
>
>Following is my query that returns the disctinct entries in the database
>named "hd".
>
>$result=mysql_query("SELECT DISTINCT hd_type, hd_brand, mb, cyl, heads,rpm,
>HD_cmt
>					FROM hd_tbl
>					ORDER BY hd_type, hd_brand, 
>mb DESC",$db);
>
>My question is, is there any way to count how many distinct entries there
>are in each row.  I'm using PHP3 with mySQL.  Thanks for the help.  I know
>I can write a function to do this but just wondering if there is any built
>in mySQL function available for this.

If you're using MySQL 3.23, you can use COUNT(DISTINCT col1[,col2,...])

-- 
Paul DuBois, paul@stripped
Thread
counting distinct entires in a DISTINCT row query.Nasir Ali25 Jun
  • Re: counting distinct entires in a DISTINCT row query.Paul DuBois25 Jun
Re: counting distinct entires in a DISTINCT row query.Nasir Ali25 Jun