Return Random Records

NPUser

Registered User.
Local time
Today, 08:00
Joined
Jul 25, 2004
Messages
55
I have a table "tbl_attend", which looks like this.

ListNum ID_num EventID Attend
1 23 1 Y
2 23 2 Y
3 23 3 Y
4 56 2 Y
5 56 3 Y
6 29 1 Y
7 56 1 Y


I would like to query unique ID_num where eventid = 1 and 2 and 3 and Attend ='Y'.

e.g:
ID_Num
23
56

My ultimate goal is to find random five Id_nums who have attended 1,2 and 3 events.


Please, please, please, guide me.

thanks in advance.
 
Try this. Make sure I spelled your fields correctly!

SELECT tbl_attend.ListNum, tbl_attend.ID_num, tbl_attend.EventID, tbl_attend.Attend
FROM [tbl_attend]
HAVING (((tbl_attend.EventID)=2) OR (((tbl_attend.EventID)=1)) OR (((tbl_attend.EventID)=3)) AND ((tbl_attend.Attend)="Y"));
 
Last edited:
To get the Id_nums who have attended 1, 2 and 3 events, you can add the table 3 times in query design, and link the ID_Num fields between the tables.

Then drag the fields to the columns and set the criteria (see attached database.)


For randoum selection, you can search for the key words Random and Randomize in these forums.
.
 

Attachments

Last edited:
Thank you

That is what i need. Thank you very much Jon K. You saved my day.
thanks
suresh
 

Users who are viewing this thread

Back
Top Bottom