On Tue, 3 Apr 2001, Marcos wrote:

> hi,
>    i would like to show 5 random field from a total of 100.
>    id is my primary key
> 
>    id      name
>   --    ----
>    ab    marcos
>    ak    john
>  ............
> 
>   how can i show 5 of them randomly?
> 
> thanks in advance,
> 
> marcos

When you say "5 random fields" I assume you mean "5 random rows".
select * from table order by rand() limit 5;

Read the SELECT from the manual (http://www.mysql.com/doc/S/E/SELECT.html)


regards,
thalis


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to