rash901
Starting Member
8 Posts |
Posted - 2014-11-12 : 06:06:17
|
m getting error "Incorrect syntax near the keyword 'else'"please help m stuck below is my codedeclare @a varchar(15), @b Float(12) ,@c Float(12),@m varchar(15),@n Float(15),@av Float(15),@xav float(15)SELECT @a=reverse(Substring(reverse(remarks),Charindex('tS',REVERSE(remarks))+2,4)) FROM [IVRS_MIS].[dbo].[logs] where app_name='IVFRT_POC' and remarks like '%answered%'if @a = 1020SELECT @m = '1022', @n = Count(@a), @av = Count(@a)/4.0 ,@b = substring(MAX(right(node_info, charindex('X',reverse(node_info))-8)),1,5) ,@c=substring(MIN(right(node_info, charindex('X',reverse(node_info))-8)),1,5),@xav=(@b+@c)/2.0 FROM [IVRS_MIS].[dbo].[logs]where APP_NAME='IVFRT_POC' AND remarks like '%No:1022Status:answered%'select Distinct @m, @n,@av,@xavFROM [IVRS_MIS].[dbo].[logs] else if @a = 1021SELECT @m = '1021', @n = Count(@a), @av = Count(@a)/4.0 ,@b = substring(MAX(right(node_info, charindex('X',reverse(node_info))-8)),1,5) ,@c=substring(MIN(right(node_info, charindex('X',reverse(node_info))-8)),1,5),@xav=(@b+@c)/2.0 FROM [IVRS_MIS].[dbo].[logs]where APP_NAME='IVFRT_POC' AND remarks like '%No:1022Status:answered%'select Distinct @m, @n,@av,@xavFROM [IVRS_MIS].[dbo].[logs] else if @a =1022SELECT @m = '1022', @n = Count(@a), @av = Count(@a)/4.0 ,@b = substring(MAX(right(node_info, charindex('X',reverse(node_info))-8)),1,5) ,@c=substring(MIN(right(node_info, charindex('X',reverse(node_info))-8)),1,5),@xav=(@b+@c)/2.0 FROM [IVRS_MIS].[dbo].[logs]where APP_NAME='IVFRT_POC' AND remarks like '%No:1022Status:answered%'select Distinct @m, @n,@av,@xavFROM [IVRS_MIS].[dbo].[logs]else if @a=1023SELECT @m = '1022', @n = Count(@a), @av = Count(@a)/4.0 ,@b = substring(MAX(right(node_info, charindex('X',reverse(node_info))-8)),1,5) ,@c=substring(MIN(right(node_info, charindex('X',reverse(node_info))-8)),1,5),@xav=(@b+@c)/2.0 FROM [IVRS_MIS].[dbo].[logs]where APP_NAME='IVFRT_POC' AND remarks like '%No:1022Status:answered%'select Distinct @m, @n,@av,@xavFROM [IVRS_MIS].[dbo].[logs] |
|