Reply to Re: 10 Random records, 1 from each category

Your name:

Reply:


Posted by FrankEBailey on 12/01/06 19:01

Hi Roy,

On Dec 1, 4:28 pm, Roy Harvey <roy_har...@snet.net> wrote:
> Do the NewID bit in a subquery. This very untested code should give
> you some ideas.
>
> SELECT *
> FROM Category as C
> JOIN Records as R
> ON C.Category_ID = R.Category_ID
> WHERE R.PK =
> (select TOP 1 R2.PK
> from Record as R
> where C.Category_ID = R2.Category_ID
> order by NewID())

This returns a single row, which is indeed random, but doesn't quite
produce the result I need. Is there perhaps any way to return, say, 10
records, each of which comes out of one of the ten available
categories, but are randomised?

Thanks
FEB

[Back to original 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

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