Re: How do I select a certain number of records randomly from a ta
- From: "Dale Fye" <dale.fye@xxxxxxxxxx>
- Date: Wed, 24 Aug 2005 21:44:48 -0400
No, it is supposed to be a SQL statement, although I forgot to put the field
names in the statement. It should read:
SELECT Top 20 Question_Num, Question_Text, Question_Response_Type, Field2,
Field2, Field3, Field4
FROM yourTable
ORDER BY (put something in here to order the values by)
You don't indicate where you want to display these questions when you are
done pulling them. I assume you have a form to display the question and the
potential responses. You just indicated you wanted to know how to select a
specific number of questions. The down side of using the TOP predicate is
that it will pull the top 20 (in this case) plus any additional records that
have the same values in the fields used in the order by criteria contained
in the 20th record. If you have a database of addresses, and sort by
ZipCode, you could get a 100 or more records. If, on the other hand, you
have a field in the table that contains a random double precision number,
sorting on this field will generally get you almost unique results.
Dale
"AdamW3995" <AdamW3995@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BAA942E1-CC95-4120-B999-B9E5E1229B5C@xxxxxxxxxxxxxxxx
> Is that supposed to be an expression? The idea is to give a field on the
> startup form, and based on the number indicated in that field, it would
> pull
> that number of questions. I need to limit access to the table entirely.
>
> "Dale Fye" wrote:
>
>> SELECT Top 20
>> FROM yourTable
>>
>> HTH
>> Dale
>> "AdamW3995" <AdamW3995@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:E71FB86B-445C-4F80-9ECB-7259D1BD2377@xxxxxxxxxxxxxxxx
>> > I'm building a database to give a randomized test based off of the
>> > number
>> > of
>> > questions I select. Example: I have a table with 100 questions, but I
>> > want
>> > to only select 20, at random, and have them displayed in a report. Can
>> > this
>> > be done easily? I already know how to randomize the questions, I just
>> > need a
>> > way to tell it to select only a designated amount.
>>
>>
>>
.
- References:
- Prev by Date: Re: vehicle expense query
- Next by Date: Re: help with a running balance...
- Previous by thread: Re: How do I select a certain number of records randomly from a ta
- Next by thread: When I run this query access asks for only one parameter
- Index(es):
Relevant Pages
|