Redian新闻
>
Rookie's question: How to combine two tables horizontally
avatar
Rookie's question: How to combine two tables horizontally# Database - 数据库
M*7
1
Hi all. I am a rookie of SQL. Here is my question:
table 1:
number name
1 A
2 B
3 C
table 2:
city zip
AA 01
BB 02
CC 03
the two tables are not related at all. How could I use SELECT to get the
table 3 as below
table 3:
number name city zip
1 A AA 01
2 B BB 02
3 C CC 03
Thanks a lot.
avatar
l*n
2
Let me try
you have to add a column in each table, just use the index number. then do a
simple join. Otherwise you will have the product of the 2 tables, which is
not what you want.

【在 M***7 的大作中提到】
: Hi all. I am a rookie of SQL. Here is my question:
: table 1:
: number name
: 1 A
: 2 B
: 3 C
: table 2:
: city zip
: AA 01
: BB 02

avatar
M*7
3
Thanks a lot. I did it.

【在 M***7 的大作中提到】
: Hi all. I am a rookie of SQL. Here is my question:
: table 1:
: number name
: 1 A
: 2 B
: 3 C
: table 2:
: city zip
: AA 01
: BB 02

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。