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

Your name:

Reply:


Posted by Roy Harvey on 12/01/06 19:13

Sorry, I'm out of ideas.

I am curious though. I assume you ran the query, and you say it
returned a single row. I expected it to return one row for each
Category. What exactly did it return?

Roy

On 1 Dec 2006 11:01:00 -0800, "FrankEBailey" <FrankEBailey@gmail.com>
wrote:

>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

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