List:General Discussion« Previous MessageNext Message »
From:peter lovatt Date:February 14 2008 3:38pm
Subject:Re: select unique ?
View as plain text  
SELECT DISTINCT Colour
FROM tablename

Peter





On 14/02/2008, Richard <mysql_list@stripped> wrote:
>
> Hello,
>
> I don't know if it is possible to do this with mysql alone ...
> Here goes :
> I've got a database list which is like to following :
>
> Num     |       Name    |       Colour
> -------------------------------------------
> 1       |       Harry   |       Red
> 2       |       Tom     |       Blue
> 3       |       Jane    |       Green
> 4       |       Philip  |       Red
> 5       |       Sarah   |       Red
> 6       |       Robert  |       Blue
>
>
> And from this table I wish to get a list of used colours.
>
> The correct answer would be :
>
> Colour
> ---------
> Red
> Blue
> Green
>
> The answer I don't want :
>
> Colour
> --------
> Red
> Blue
> Green
> Red
> Red
> Blue
>
> How would I achieve the first result with mysql ? Is it possible?
>
>
> Thanks in advance,
>
> Richard
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=1
>
>

Thread
select unique ?Richard14 Feb
  • Re: select unique ?peter lovatt14 Feb
  • Re: select unique ?Ben Clewett14 Feb
    • RE: select unique ?Randall Price15 Feb
      • Re: select unique ? (solved thankyou :))Richard16 Feb
      • Re: select unique ?Baron Schwartz16 Feb