我有两张表。我试图将下面的两个示例表与表1结合起来,两次引用表2。例如,如果我查看表1:第2组和成员7,则应在表2中查找ID,并提供以下输出:
Group Members Name Name 2 7 Blue Dog
表1
Group Members 2 7 3 8 5 10
表2
ID Name 1 Green 2 Blue 3 Yellow 4 Orange 5 Red 6 Elephant 7 Dog 8 Cat 9 Chicken 10 Mouse
有什么建议吗?谢谢
SELECT Table_1.*, g.Name, m.Name FROM Table_1 INNER JOIN Table_2 AS g ON Table_1.Group=g.ID INNER JOIN Table_2 AS m ON Table_1.Group=m.ID WHERE Table_1.Group=2 AND Table_1.Member=7