2023年7月13日发(作者:)
sql表变量的使⽤最近第⼀次使⽤sql表变量,感觉挺好⽤,案例如下:
declare @aaa table(Com_SiteGroupID uniqueidentifier) --定义表变量
---往表变量⾥写数据insert into @aaa select Com_SiteGroupID from Com_SiteGroup where Com_StructureID =@whereId
union allselect _SiteBasicID from Com_SiteBasic a inner join Com_SiteGroup b on
_SiteGroupID=_SiteGroupID where _StructureID=@whereId--读取表变量的数据insert into #temp select Text,count(*) as CountNum from Sip_HiddenDisposalInfo a
inner join Sc_InspectionContent b
on _InspectionContentID=_InspectionContentId inner join Sc_InspectionItem c
on _InspectionItemId=_InspectionItemId where evel=2
and in (select * from @aaa)
and Time>=@firtTime and Time<=@lastTime group by Text
发布者:admin,转转请注明出处:http://www.yc00.com/xiaochengxu/1689248592a225706.html
评论列表(0条)