查询几张表中并集
select b.* from CorpBasic b where 1=1
and b.ID in(
select CorpID from CorpSMS where 1=1 and RoleID in(-999 ,1)
[b]union[/b]
select CorpID from CorpWap where 1=1 and RoleID in(-999 ,1)
[b]union[/b]
select CorpID from CorpComWeb where 1=1 and RoleID in(-999 ,1)
)
查询几张表中交集
select b.* from CorpBasic b where 1=1
and b.ID in(
select CorpID from CorpSMS where 1=1 and RoleID in(-999 ,1)
[b]intersect[/b]
select CorpID from CorpWap where 1=1 and RoleID in(-999 ,1)
[b]intersect[/b]
select CorpID from CorpComWeb where 1=1 and RoleID in(-999 ,1)
)
select b.* from CorpBasic b where 1=1
and b.ID in(
select CorpID from CorpSMS where 1=1 and RoleID in(-999 ,1)
[b]union[/b]
select CorpID from CorpWap where 1=1 and RoleID in(-999 ,1)
[b]union[/b]
select CorpID from CorpComWeb where 1=1 and RoleID in(-999 ,1)
)
查询几张表中交集
select b.* from CorpBasic b where 1=1
and b.ID in(
select CorpID from CorpSMS where 1=1 and RoleID in(-999 ,1)
[b]intersect[/b]
select CorpID from CorpWap where 1=1 and RoleID in(-999 ,1)
[b]intersect[/b]
select CorpID from CorpComWeb where 1=1 and RoleID in(-999 ,1)
)