create table a(id number, name varchar2(10));
insert into a(id, name) values(5, 'Peter');
insert into a(id, name) values(2, 'Steven');
insert into a(id, name) values(6, 'Paul');
insert into a(id, name) values(4, 'Ivan');
create table b(id number, name varchar2(10));
insert into b(id, name) values(5, 'Jones');
insert into b(id, name) values(2, 'Pareker');
insert into b(id, name) values(1, 'Smith');
insert into b(id, name) values(3, 'Parker');
select * from a full join b on a.id = b.id
order by
case
when a.id is not null and b.id is not null then 0
when a.id is not null and b.id is null then 1
when a.id is null and b.id is not null then 2
else 3
end
;
究竟什麼是你的問題? – 2010-04-13 09:29:00
請正確格式化。它目前的狀態是不可讀的。 – 2010-04-13 09:34:35