首页 新闻 会员 周边 捐助

SQL 类似三元表达式转换

0
悬赏园豆:5 [已关闭问题] 关闭于 2020-04-21 14:20
set
   WI.BlockForWarrantyReason = 
                  --( CASE WHEN OW.BlockedForWarrantyReason = 'CC01'
                  --       THEN 'Repair'
                  --       WHEN OW.BlockedForWarrantyReason IN ( 'CC02', 'CC03',
                  --                                            'CC04' )
                  --       THEN 'Physical Exchange'
                  --       WHEN OW.BlockedForWarrantyReason IN ( 'CC05', 'CC06' )
                  --       THEN 'Credit Note'
                  --       ELSE OW.BlockedForWarrantyReason
                  --  END ) 
				 
		  (CASE WHEN    OW.BlockedForWarrantyReason =	(select   Code from TB_GWED_BaseData where btype='TCAServiceSolution'  AND  Code=OW.BlockedForWarrantyReason )
		 THEN  (select   BName  from TB_GWED_BaseData where btype='TCAServiceSolution'  AND  Code=OW.BlockedForWarrantyReason ) ELSE  
		 OW.BlockedForWarrantyReason
		 END) 
   FROM #WarrantyInfo WI
		LEFT JOIN  fWarrantyInfo OW ON OW.SN = WI.SN
		 

请问这里如何优化?
这里这个表数据量很小的,其实就是上面注释的哪些代码,不过现在表分开了.

永远跟党走i的主页 永远跟党走i | 小虾三级 | 园豆:1542
提问于:2020-04-20 17:26
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册