You are here: Re: Newbie needs help with query « PHP Language « IT news, forums, messages
Re: Newbie needs help with query

Posted by Gleep on 03/06/07 20:22

On Tue, 6 Mar 2007 07:54:20 +0000, raj <raj@nospam.com> wrote:

>Hi,
>
>Is there a query which will select x random unique records out of all records
>and sort them randomly, but if all records is smaller than x then it chooses
>all the records and sorts them randomly.
>
>e.g choose 3 random unique records out of all records (20) and sort them
>randomly (5,1,14) , but if there are only 2 records it chooses the 2 records
>and sorts them randomly (2,1).
>
>Thank you in advance,
>
>Raj (Newbie)



$qry = "SELECT * FROM yourtable ORDER BY rand() LIMIT 20";

simple

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация