22,209
社区成员
发帖
与我相关
我的任务
分享
select x.* from x
inner join y
on isnull(x.A,0)=isnull(y.A,0) and isnull(x.B,0)=isnull(y.B,0)
--> (让你望见影子的墙)生成测试数据,时间:2009-02-13
if not object_id('X') is null
drop table X
Go
Create table X([A] int,[B] nvarchar(2),[C] int)
Insert X
select 1,N'a',22 union all
select 1,null,33
Go
Select * from X
--> (让你望见影子的墙)生成测试数据,时间:2009-02-13
if not object_id('Y') is null
drop table Y
Go
Create table Y([A] int,[B] nvarchar(2),[D] int)
Insert Y
select 1,N'a',44 union all
select 1,null,55
Go
Select * from Y
select X.*
from X join Y on x.a=y.a and isnull(x.b,0)=isnull(y.b,0)
1 a 22
1 NULL 33