表一:
StudentId, StudentName, School
1 Sam ABC
表二:
StudentCity StudentId
Paris 1
mexico 2
答案应该是“Paris”,因为StudentId是1
select StudentCity
from TWO
where StudentId = (select StudentId from ONE where StudentName="SAM");
请建议我使用sql查询。
最佳答案
select StudentCity from TWO
inner join ONE on ONE.StudentId = TWO.StudentId
where ONE.StudentName= "SAM"
关于mysql - 如何合并两个选择和两个where子句?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56859798/