Forums

ASP

This topic is locked

Join in access

Posted 28 Nov 2005 16:06:57
1
has voted
28 Nov 2005 16:06:57 Rohan Sootarsing posted:
Hi is it possible to do a join using a ms access db?
I have two tables One Called users one called lookup
Basically i want to list all the users that want to attend a course
So I have 3 tables essentially Users Courses and Lookup
Users has UserId Name PW etc Courses has Course Id Course name etc etc
And Lookup Just has UserID and CourseID Basically when someone signs up for a course it just logs the course id and thier userid into the lookup table
I then want to return a query for example if i click a course I want to see all the users that are registered so i need to query the lookup table for all the user id's that are there for that course id and then query the user table to match a name with the user id
Can anyone help??

Cheers

Replies

Replied 02 Dec 2005 11:06:41
02 Dec 2005 11:06:41 richard fuller replied:
selectedcourse = request("id"
sql = "select * from courses INNER JOIN lookup ON course.courseID = lookup.courseid INNER JOIN users ON course.UserID = users.UserID WHERE courseID = '" & selectedcourse &"'"

Then you can select any column from these three tables as long as you pass through a variable id to select the course id.I have assumed the course id is a text string, not a number, if it is a number just remove the single quotes from the sql

Regards

Richard

Reply to this topic