gpt4 book ai didi

mysql - 如何将表A中的某些行交叉连接到表B中的某些列

转载 作者:行者123 更新时间:2023-11-29 18:15:41 25 4
gpt4 key购买 nike

我有两个表,表 A 和表 B :

表A

+----------+-----------+--------+
| s_number | sname | city |
+----------+-----------+--------+
| s1 | fanavaran | tehran |
| s2 | iranghate | tabriz |
| s3 | poladin | tariz |
+----------+-----------+--------+

表B

+----------+-------+--------+--------+
| p_number | color | type | city |
+----------+-------+--------+--------+
| p1 | red | ahan | tehran |
| p2 | green | mes | tabriz |
| p3 | blue | bereng | shiraz |
| p4 | red | ahan | tehran |
+----------+-------+--------+--------+

我想要交叉连接表 A(其中 city = 'tehran'),以便为表 B 中的列着色并键入列。

我该怎么办?

最佳答案

尝试这个查询...

select * from table_a as a INNER JOIN table_b as b ON a.city = b.city where a.city = 'tehran'

关于mysql - 如何将表A中的某些行交叉连接到表B中的某些列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47048380/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com