访问 SQL 内部连接 ​​3 个没有 like 字段的表

Access SQL Inner join 3 tables without like field

首先,我很确定我的答案在这里:SQL Inner-join with 3 tables?

但是两周后,我放弃了。

AssemLines 示例数据:

ID   -   AssemID   -   ItemID  -   ItemQty -  ServiceID   -  ServiceQty
1           1            12          102                        
2           1            62          15                              
3           1                                    3              45
4           2                                    6              90
5           2            23           5 

想要的查询结果:

AssemID   -   ItemName     -   ItemQty     -   ServiceName    -   ServiceQty
1               2" tube         102                          
1               3" tube         15
1                                                 Weld               45
2                                                 Saw                90
2               1" tube          5

有什么想法吗?

您似乎只想用在其他表中查找的专有名称替换 id。所以最基本的连接应该可以工作:

SELECT a.AssemID, i.ItemName, a.ItemQty, s.ServiceName, a.ServiceQty
FROM AssemLines a
LEFT JOIN Items i
  ON a.ItemID = i.ItemID
LEFT JOIN Services s
  ON a.ServiceID = s.ServiceID