热线电话:13121318867

登录
2020-03-31 阅读量: 725
MySQL:先连纵向,再连横向,可行吗?

答:可行,如下面例子:

create database test;

use test;

create table t1(

a int,

b int);

create table t2(

a int,

b int);

create table t3(

a int,

c int);

insert t1 values(1,1),(2,2);

insert t2 values(3,3),(4,4);

insert t3 values(1,11),(2,22),(3,33),(4,44);

(select * from t1) union (select * from t2);

select * from t3 left join ((select * from t1) union (select * from t2)) as t4 on t3.a = t4.a;

18.6914
2
关注作者
收藏
评论(0)

发表评论

暂无数据