ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] MS SQL full join°ÝÃD

[µo°Ý] MS SQL full join°ÝÃD

--MS SQL full join°ÝÃD
declare @t1 table (f1 nvarchar(50), f2 nvarchar(50))
declare @t2 table (f1 nvarchar(50), f3 nvarchar(50))
declare @t3 table (f1 nvarchar(50), f4 nvarchar(50))
insert into @t1 (f1,f2) values ('a','1')
insert into @t1 (f1,f2) values ('c','2')
insert into @t1 (f1,f2) values ('d','3')
insert into @t2 (f1,f3) values ('a','4')
insert into @t2 (f1,f3) values ('b','5')
insert into @t2 (f1,f3) values ('d','6')
insert into @t3 (f1,f4) values ('c','7')
insert into @t3 (f1,f4) values ('e','8')
--select t1f1=t1.f1,t2f1=t2.f1,t3f1=t3.f1,f2,f3,f4
select f1=isnull(t1.f1,isnull(t2.f1,t3.f1)),f2,f3,f4
from @t1 t1
full join @t2 t2 on t1.f1=t2.f1
full join @t3 t3 on t2.f1=t3.f1
order by f1
¤W¦Cµ²ªG¦p¹Ï1,f1ªº­È¦³'c'­«½Æ
¦p¦ó¯à¦³¹Ï2ªºµ²ªG? (f1¤£­n­«½Æ)
§Úª¾¹D§ï¦¨
select f1=isnull(t1.f1,isnull(t2.f1,t3.f1)),f2,f3,f4
from @t1 t1
full join @t2 t2 on t1.f1=t2.f1
full join @t3 t3 on t1.f1=t3.f1
order by f1
¯à¹F¨ì¥Øªº,¦ý³o¬O¥©¦X,¤£«OÀI,
¦]¬°¹ê°È¤W¦Utable­È«Ü¦h,µLªk¤@¤@¥hÀˬd¦³­þ¨Ç·|¨S¹ïÀ³¨ì
½Ð°Ý¦³¨S¦³ªv¥»¤§¹D?

¹Ï:
https://drive.google.com/file/d/0B43q2SqHw8xcUlRZVnZuaHViUjQ/view
Symis

        ÀR«ä¦Û¦b : µoµÊ®ð¬Oµu¼ÈªºµoºÆ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD