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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query on linked tables 1

Status
Not open for further replies.

gord2

Programmer
Jun 20, 2003
16
CA
Hi, I need help to select data from 2 linked tables.

The two tables have the following format:

Table 1
ID Name Status
01 Adam 1
02 Bob 1
03 Coby 1
...

Table 2
ID Skill Level
01 Code A
01 Word 2
01 Excel 1
01 Access 1
02 Code A
02 Excel 2
03 Code B
03 Word 1
03 Excel 2
...

They are linked by common field "ID".

I want select fields ID, Name, Code Level based on the condition with Skill is "Excel" and "Excel" level is "2" and Status is "1".

The result should be:

ID Name Level of Code
-----------------------
02 Bob A
03 Coby B

How can I achieve this?

Thanks

 
A starting point:
SELECT A.ID, A.Name, C.Level
FROM ([Table 1] AS A
INNER JOIN [Table 2] AS B ON A.ID = B.ID)
INNER JOIN [Table 2] AS c ON A.ID = C.ID
WHERE B.Skill = 'Excel' AND B.Level = '2'
AND A.Status = 1 AND C.Skill = 'Code'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top