分类目录

链接

2024 年 4 月
1234567
891011121314
15161718192021
22232425262728
2930  

近期文章

热门标签

新人福利,免费薅羊毛

变量表与临时表的效率分析

昨日一朋友发来一段sql的存储过程(如下),让我看看能不能优化一下。 insert @T1 select g_no,co_no,si_no,str_no,sum(ind_qty) as qty from instock_detail where  in_id = @id  group by g_no,co_no,si_no,str_no--?unitstock  -->保存在变量表中 insert @T2 select a.* from  unitstock a,@T1 b where a.g_no =b.g_no  and a.co_no =b.co_no and a.si_no =b.si_no and a.str_no=b.str_nodelete unitstock from @T1 a where unitstock.g_no=a.g_no  and unitstock.co_no =a.co_no and unitstock.si_no=a.si_...

SQL Server 暂无评论 阅读(2,262)