Hi

You can use "select distinct names from table_name order by rand() limit 3".
Hope this helps and let me know.

cheers
Binay


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 6:36 PM
Subject: [PHP] Random selection


> Hi,
>
> Can you help me with this one??
>
> In my mysql db i have a colum called names;
>
> In names their are:
>
> Frank
> Frank
> Bob
> Alice
> Bob
> Alice
> Jim
> Alice
> Frank
>
> I want to make a random selection (max 3 value's for example).. Only it
may not produce two times the same name. For example;
>
> This is the output:
>
> Frank, Jim, alice
>
> Wrong output
>
> Frank, Frank, Jim
>
> Please help!
>
> Thanks,
>
> Frank
>
>
>


----------------------------------------------------------------------------
----


> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to