34,589
社区成员
发帖
与我相关
我的任务
分享
--测试数据
if not object_id(N'Tempdb..#A') is null
drop table #A
Go
Create table #A([id] int)
Insert #A
select 1 union all
select 2 union all
select 3
GO
if not object_id(N'Tempdb..#B') is null
drop table #B
Go
Create table #B([id] int,[aid] int)
Insert #B
select 1,1 union all
select 2,3
Go
--测试数据结束
Select #A.* from #A JOIN #B ON #B.aid = #A.id