title: Incorrect syntax near keyword "AND" SQL Server Update/Case statement
body: <p>Working on an update query with multiple joins and case statements. I keep getting the error "Incorrect syntax near the keyword 'AND'".</p>
  
  <p>I have rearranged my join to avoid subqueries, but can't fix this issue.</p>
  
  <p>Code:</p>
  
  <pre><code>UPDATE a
  SET a.[FldrInit] = 
  (CASE a.FldrInit
  WHEN '889' AND d.GisCode LIKE 'HAP%' OR d.GisCode LIKE 'SAP%' THEN '889G1Pt'
  WHEN '889' AND d.GisCode LIKE 'HAS%' OR d.GisCode LIKE 'SAS%' THEN '889G1Road'
  WHEN '889' AND d.GisCode LIKE 'A????' THEN '889ProxixPt'
  WHEN '889' AND d.gis LIKE 'R????' THEN '889ProxixRoad'
  WHEN '883' THEN '883'
  WHEN '885' THEN '885'
  WHEN '886' THEN '886'
  WHEN '887' THEN '887'
  WHEN '900' THEN '900'
  WHEN '902' THEN '902'
  ELSE 'Other'
  END)
  FROM [dbo].[QCOrders_temp] as a 
  INNER JOIN [dbo].[QCCloneOrders] as b 
  ON b.NewOrdnum=a.OrdDte 
  INNER JOIN [TOD].[dbo].[CurrentOrders] as c
  ON c.Ordnum = b.OrigOrdnum
  INNER JOIN [TOD].[dbo].[Addr] as d
  ON d.RecNumAddr = c.RecNumAddr
  
  WHERE a.FldrInit IS NULL
  </code></pre>
  
  <p><strong>EDIT</strong>
  @BhupeshC fixed the error, except now I'm getting a new one-- "Incorrect syntax near keyword 'END'". Any thoughts?</p>
  
  <pre><code>UPDATE a
  SET a.[FldrInit] = 
  CASE 
  WHEN a.FldrInit = '889' AND d.GisCode LIKE 'HAS%' OR d.GisCode LIKE 'SAS%' THEN '889G1Road'
  WHEN a.FldrInit = '889' AND d.GisCode LIKE 'A????' THEN '889ProxixPt'
  WHEN a.FldrInit = '889' AND d.GisCode LIKE 'R????' THEN '889ProxixRoad'
  WHEN a.FldrInit IN ('883', '885', '886', '887', '900', '902') THEN a.FldrInit
  ELSE 'Other'
  END
  FROM [dbo].[QCOrders_temp] as a 
  INNER JOIN [dbo].[QCCloneOrders] as b 
  ON b.NewOrdnum=a.OrdDte 
  INNER JOIN [TOD].[dbo].[CurrentOrders] as c
  ON c.Ordnum = b.OrigOrdnum
  INNER JOIN [TOD].[dbo].[Addr] as d
  ON d.RecNumAddr = c.RecNumAddr
  
  WHERE a.FldrInit IS NULL
  </code></pre>