如下语句取fourteen_status这个字段中带有付常减压(Ⅰ)的数值,比如说我想把语句修改为8:00取fourteen_status这个字段,16:00取另一个字段值怎么修改?20:00取得字段值名为lsix_status,其他条件不变。 select productname,sum(value) as valuex,case when fourteen_status like N'%付常减压(Ⅰ)%' then N'一期原油比例' when fourteen_status like N'%付常减压(II)%' then N'二期原油比例' end as typex from ( select * from (select substring(a.TagName,6,3)+'_'+substring(a.TagName,9,1)+'_'+substring(a.TagName,10,2) as newTagName , a.TagName,a.TimeStamp,a.Value-b.Value as Value,a.Confidence,a.HostName,a.Units,a.FormatedTime from (select * from dbo.Fun_CO_GetPHDValue('TANK.211T01.MAS;TANK.211T02.MAS;TANK.211T03.MAS;TANK.211T04.MAS;TANK.212T01.MAS;TANK.212T02.MAS;TANK.212T03.MAS;TANK.212T04.MAS;TANK.240T03.MAS;TANK.240T04.MAS;TANK.600T08.MAS;TANK.600T09.MAS;TANK.240T01.MAS;TANK.240T02.MAS;TANK.240T05.MAS;TANK.240T06.MAS;TANK.241T01.MAS;TANK.241T02.MAS;TANK.241T03.MAS;TANK.241T04.MAS;TANK.241T05.MAS;TANK.241T06.MAS',dateadd(mi,-10,getdate())))a, (select * from dbo.Fun_CO_GetPHDValue('TANK.211T01.MAS;TANK.211T02.MAS;TANK.211T03.MAS;TANK.211T04.MAS;TANK.212T01.MAS;TANK.212T02.MAS;TANK.212T03.MAS;TANK.212T04.MAS;TANK.240T03.MAS;TANK.240T04.MAS;TANK.600T08.MAS;TANK.600T09.MAS;TANK.240T01.MAS;TANK.240T02.MAS;TANK.240T05.MAS;TANK.240T06.MAS;TANK.241T01.MAS;TANK.241T02.MAS;TANK.241T03.MAS;TANK.241T04.MAS;TANK.241T05.MAS;TANK.241T06.MAS',dateadd(mi,-70,getdate())))b where a.TagName=b.TagName )x1 left join (select mesreport.dbo.t_Oilcan_Data.productname,mesreport.dbo.t_Oilcan_Config.oilcan_no,fourteen_status from mesreport.dbo.t_Oilcan_Data left join mesreport.dbo.t_Oilcan_Config on mesreport.dbo.t_Oilcan_Data.oilcanid= mesreport.dbo.t_Oilcan_Config.oilcanid where oilcan_date=(select max(oilcan_date) from mesreport.dbo.t_Oilcan_Data ) )x2 on x1.newTagName=x2.oilcan_no where value<0 and (fourteen_status like (N'%付常减压(Ⅰ)%') or fourteen_status like (N'%付常减压(II)%')) and oilcan_no in('211_T_01','211_T_02','211_T_03','211_T_04','212_T_01','212_T_02','212_T_03','212_T_04','240_T_01','240_T_02','240_T_03','240_T_04','240_T_05','240_T_06','241_T_01','241_T_02','241_T_03','241_T_04','241_T_05','241_T_06') )mm
group by productname,fourteen_status
order by fourteen_status |