我有两个表作为表A和表B:
表A
a
表B
+----------+-----------+--------+
| s_number | sname | city |
+----------+-----------+--------+
| s1 | fanavaran | tehran |
| s2 | iranghate | tabriz |
| s3 | poladin | tariz |
+----------+-----------+--------+
我想要加入表A,其中city =' tehran'从表B中着色和输入列。
我该怎么办?
答案 0 :(得分:0)
尝试此查询...
select * from table_a as a INNER JOIN table_b as b ON a.city = b.city where a.city = 'tehran'
答案 1 :(得分:0)
/ *尝试以下* /
sideMenuImage
答案 2 :(得分:0)
您希望在表A上使用左连接,以便列出表A中的所有项目,即使它们在表B中不存在。
select A.city, B.color, B.type from A left join B on A.city=B.city where A.city="tehran";