SQL code: select (select name from tb where id=id1) as id1 from tb2
SQL code: select a.name,b.name,c.name from tb t left join ta a on t.id1=a.id left join ta b on t.id2=b.id left join ta b on t.id3=c.id
ok? 动态? SQL code: --> 测试数据: #T1 if object_id('tempdb.dbo.#T1') is not null drop table #T1 create table #T1 (id int,name varchar(4)) insert into #T1 select 1,'小张' union all select 2,'小李' union all select 3,'小陈' --> 测试数据: #T2 if object_id('tempdb.dbo.#T2') is not null drop table #T2 cr