当前位置:Gxlcms > 数据库问题 > sql 表变量的使用

sql 表变量的使用

时间:2021-07-01 10:21:17 帮助过:62人阅读

select Com_SiteGroupID from Com_SiteGroup where Com_StructureID =@whereId
union all
select a.Com_SiteBasicID from Com_SiteBasic a inner join Com_SiteGroup b on
a.Com_SiteGroupID=b.Com_SiteGroupID where b.Com_StructureID=@whereId

--读取表变量的数据

insert into #temp select c.ObjectText,count(*) as CountNum from Sip_HiddenDisposalInfo a
inner join Sc_InspectionContent b
on a.Sc_InspectionContentID=b.Sc_InspectionContentId inner join Sc_InspectionItem c
on b.Sc_InspectionItemId=c.Sc_InspectionItemId where c.CheckLevel=2
and a.SiteID in (select * from @aaa)
and a.CreateTime>=@firtTime and a.CreateTime<=@lastTime group by c.ObjectText

sql 表变量的使用

标签:create   rtt   content   table   join   sql   pos   sel   evel   

人气教程排行