日期:2014-05-17 浏览次数:20601 次
Use tempdb;
Go
Create table [dbo].[a] (name varchar null);
Create table [dbo].[b] (name varchar null);
Create table [dbo].[c] (name varchar null);
Insert Into [dbo].[a] values ('a'),('b'),('c');
Insert Into [dbo].[b] values ('a'),('d'),('c');
Insert Into [dbo].[c] values ('a'),('e'),('f');
GO
Select name From dbo.a
except (
Select name From dbo.a
Intersect
Select name From dbo.b
Intersect
Select name From dbo.c
)
Union All
Select name From dbo.b
except (
Select name From dbo.a
Intersect
Select name From dbo.b
Intersect
Select name From dbo.c
)
Union All
Select name From dbo.c
except (
Select name From dbo.a
Intersect
Select name From dbo.b
Intersect
Select name From dbo.c
)
Select name From dbo.a
except (
Select name From dbo.a
Intersect
Select name From dbo.b
Intersect
Select name From dbo.c
)
Union All (
Select name From dbo.b
except (
Select name From db