Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
您好想要获取一个表的单个列的所有条目,其中两个表的两个列匹配(如join)。
join
到目前为止,我使用以下where语句成功提取了两个表的所有列:
where
SELECT * FROM table1, table2 WHERE table1.AB_ID=table2.AB_ID
但是当我只想选择一个列时它不起作用:
SELECT colX FROM table1 WHERE table1.AB_ID=table2.AB_ID
可能是一个相当简单的问题......
我认为您需要使用联接:
SELECT table1.colX from table1 INNER JOIN table2 ON table1.AB_ID=table2.AB_ID;