Return Certain List of Values

xPaul

Registered User.
Local time
Today, 11:22
Joined
Jan 27, 2013
Messages
65
Hi all,

I am trying to make a specific query work. I already have it returning the top 5 random values using a Rnd expression.

Though, I wish to further enhance it by returning a certain amount of values, for example:

2 of anything in this list ("Honda","Toyota")
3 of anything in this list ("Nissan","Ford")
-
5 - total.

Is this possible? Hope I've explained it well enough.

Thanks!
 
Hello xPaul, Welcome to AWF.. :)

Is it possible for you to show what code you have deployed to get this Top 5 from the List of values? We can work something out from that..
 
Okay,

In the query I have selected Top Values: 5. Which returns the top 5 values.

Then, in an extra column of the query I have: Expr1: Rnd(Asc([Make])). This expression is sorted in an ascending format.

-----------------------------------------------------------------------
For reference I'll tell you the columns I have in this query:

Make - Completing Tester - Date - Outcome - Comments - Rnd(Asc([Make]))

The date field has a criteria of <=DateAdd("m",-3,Date()) Or Is Null - to return only those cars which haven't been tested within the last 3 months, or those who haven't been tested at all.

-----------------------------------------------------------------------

Thanks for the welcome by the way.
 
xPaul, can you please show us the Query along with some sample data? As I can vaguely understand what you want to do, but not entirely sure.. What is they Type of Make? So you have
Code:
SELECT[B] TOP 5[/B] fieldList FROM tableName;
 
I have created a quick mock database to show you what I mean. Find it attached.

Basically, I want to show any 3 hatchbacks or SUVs and any 2 saloons or motorbikes in the query.

You can see currently it's showing everything.
 

Attachments

Users who are viewing this thread

Back
Top Bottom