|
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]
|