Re: returning unique values in columns
| From: | rija | Date: | Thu, 14 Nov 2002 21:46:07 +0000 |
| Subject: | Re: returning unique values in columns | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124505@lists.php.net to get a copy of this message | ||
GROUP BY column ???
For example if you want the count(*) of each value
do like this
SELECT column, count(*) from 'tablename' GROUP BY column ;
----- Original Message -----
From: <drparker@clam.rutgers.edu>
To: <php-general@lists.php.net>
Sent: Friday, November 15, 2002 8:17 AM
Subject: [PHP] returning unique values in columns
> Is there any way to run a query in mysql that retuns unique values in a
> column? For example, say i had this colum:
>
> Column:
> ---------
> Fashion
> ---------
> Basics
> ---------
> Fashion
> ---------
> Plus
> --------
> Plus
> ---------
>
> but I only want it to return unique values - in this case I would only
> want Fashion, Basics, Plus - instead of the Fashion, Basics, Fashion,
> Plus, Plus I would get if I had run: SELECT column FROM tblname;
>
> any help would be greatly appreciated...
>