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