title: SQL Field Calculation based on CASE if then else
body: <p>I am trying to calculate a field. For example </p>
  
  <pre><code>select **sum(New)** as NewCST where WHERE PO ='L22411301' AND ItemNo IN('1730','1343').
  </code></pre>
  
  <p>Instead of the sum I have this whole case statement to implement. I have not done a formula calculation that has this many conditions. So any help is appreciated.</p>
  
  <p>So far I got this:</p>
  
  <pre><code>SELECT *
  FROM (SELECT 
      Case
          When  PO_SIZE like ‘%lb%’ Then  CONVERT(decimal(13,4), NET_COST / TOTAL_WEIGHT)
          When PO_SIZE like ‘%LB%’ Then  CONVERT(decimal(13,4), NET_COST / TOTAL_WEIGHT)
          Else  CONVERT(decimal(13,4), ADJ_EXT_NET_COST / LINE_QUANTITY)        
  from [FirstStrike_Retail].[custom].[Whse_Line_Item] )End AS NewCst.
  WHERE PO ='L22411301' AND ItemNo IN('1730','1343')
  </code></pre>