Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with a query

Status
Not open for further replies.
Feb 3, 2003
28
0
0
US
question, I can't seem to figure this out.

I'm using ASP to access my db.
I have an access db with 2 tables I need to get information from. table 1 has the users information and a user ID field. table 2 has the classes taken by the users and a user ID field which corresponds to the user ID from the table 1. In both tables, the user ID field is called ID.
How do I do a search on the class names in the table 2, grab the ID from the table 2 and match it to the user name in the table 1?

Example:

I'm searching for all the users who have taken a Windows 95 class. I search table 2 for the Windows 95 class from table 2 and get the user ID 4. User ID 4 in table 1 belongs to Joe Smith.

How can I do this in one query statement?
 
This is an access question,
But the answer is:

Code:
SELECT [Users].[FirstName], [Users].[LastName]
FROM Users, Classes
WHERE 
[Users].[UserID] =  [Classes].[UserID]
AND [Classes].[ClassName] = "Windows 95"

You would need to replace "Windows 95" with a "?" in order to be a passed parameter
Hope this helps


"Own only what you can carry with you; know language, know countries, know people. Let your memory be your travel bag.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top