在MySQL5中建立如下表:
create table table1(id1 int,name varchar(10));
create table table2(id2 int,score int);
insert into table1 select 1,'lee';
insert into table1 select 2,'zhang';
insert into table1 select 4,'wang';
insert into table2 select 1,90;
insert into table2 select 2,100;
insert into table2 select 3,70;希望能够用外连接(full join)查询到如下结果
select * from table1 full join table2 on id1=id2;
-------------结果-------------
id1 name id2 score
------------------------------
1 lee 1 90
2 zhang 2 100
4 wang NULL NULL
NULL NULL 3 70
------------------------------
可是结果却是id1 name id2 score
------------------------------
1 lee 1 90
2 zhang 2 100------------------------------
使用左连接和右连接都可以正确显示信息。是不是MySQL5 不支持这种完整外连接?
如果有的话应该怎么做呢?希望大家帮忙~先在这里谢谢了~
create table table1(id1 int,name varchar(10));
create table table2(id2 int,score int);
insert into table1 select 1,'lee';
insert into table1 select 2,'zhang';
insert into table1 select 4,'wang';
insert into table2 select 1,90;
insert into table2 select 2,100;
insert into table2 select 3,70;希望能够用外连接(full join)查询到如下结果
select * from table1 full join table2 on id1=id2;
-------------结果-------------
id1 name id2 score
------------------------------
1 lee 1 90
2 zhang 2 100
4 wang NULL NULL
NULL NULL 3 70
------------------------------
可是结果却是id1 name id2 score
------------------------------
1 lee 1 90
2 zhang 2 100------------------------------
使用左连接和右连接都可以正确显示信息。是不是MySQL5 不支持这种完整外连接?
如果有的话应该怎么做呢?希望大家帮忙~先在这里谢谢了~
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货