日期:2014-05-17 浏览次数:20412 次
create table #ta(ID int,A varchar(10),B varchar(10))
insert into #ta
select 50,'hello','world'
union all select 51,'hell','word'
create table #tb(ID int,C varchar(100))
insert into #tb
select 50,'hello'
union all select 50,'world hello'
union all select 51,'hell'
union all select 51,'world'
union all select 51,'lleh'
select a.*
from #ta a
inner join #tb b on a.A=b.C
inner join #tb c on a.B=c.C
drop table #ta,#tb
/*
ID A B
------------------------
50 hello world
*/