我有两张桌子。员工和资格。
员工
Emp_id Name Qualification1 Qualification2 Qualification3
10001 xxxxxx 1 3 5
10002 yyyyyy 3 2
.......
......
.....
资格
Qual_ID Qual_name
1 B.Tech
2 MCA
3 M.Tech
我如何使用联接查询获取以下输出
Emp_ID Name Qual1 Qual2 Qual3
10001 xxxxxxx B.Tech MCA pppp
10002 yyyyyyy B.Tech
......
.....
.....
最佳答案
尝试这个
Select E.Emp_ID,E.Name,Q1.Qual_Name,Q2.Qual_Name, Q3.Qual_Name
From
Employees AS E
INNER JOIN Qualifications As Q1 ON E.Qualification1=Q1.Qual_ID
INNER JOIN Qualifications As Q2 ON E.Qualification2=Q2.Qual_ID
INNER JOIN Qualifications As Q3 ON E.Qualification3=Q3.Qual_ID