|
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
Navigation:
[Reply to this message]
|