title: trying to add an additonal product group of "+P"
body: <p>just picking up work from an ex-employee and am quite new to SQL, I seem to be picking it up quite quickly but as most of our systems are live, I'm hesitant to make any drastic changes in case the websites based on these systems completely fall over.</p>
  
  <p>The question I have is, there is currently the following code in place:</p>
  
  <pre><code>SELECT  *
  FROM
  (
  SELECT  p.product,
          p.description,
          p.warehouse,
          CASE
              WHEN RIGHT(RTRIM(p.product),2) = '+P' THEN (SELECT physical_qty - allocated_qty FROM scheme.stockm p2 WHERE p2.warehouse = p.warehouse AND p2.product = REPLACE(p.product, '+P', ''))
              WHEN RIGHT(RTRIM(p.product),2) = '+P1' THEN (SELECT physical_qty - allocated_qty FROM scheme.stockm p2 WHERE p2.warehouse = p.warehouse AND p2.product = REPLACE(p.product, '+P1', ''))
              ELSE physical_qty - allocated_qty
          END AS 'Stock',
          CASE
              WHEN warehouse = 'X1' THEN trade.price * 0.85
              ELSE trade.price * 0.8
          END AS 'Price'
  FROM    scheme.stockm p INNER JOIN
          scheme.oplistm AS trade WITH(NOLOCK) ON p.product = trade.product_code AND trade.price_list = 'MT'
  WHERE   (warehouse = 'X1'
  OR      warehouse = 'X2')
  AND     analysis_b &lt;&gt; '0421'
  AND     analysis_b &lt;&gt; '0531'
  AND     analysis_b &lt;&gt; '0409'
  ) AS t
  WHERE t.Stock &gt; 0
  AND RTRIM(product) + '+P' NOT IN
  (SELECT product
  FROM    scheme.stockm
  WHERE   warehouse = 'X1'
  OR      warehouse = 'X2')
  AND RTRIM(product) + '+P1' NOT IN
  (SELECT product
  FROM    scheme.stockm
  WHERE   warehouse = 'X1'
  OR      warehouse = 'X2')
  AND     product NOT LIKE 'BAG%'
  AND     product NOT LIKE 'MDS%'
  AND     UPPER(description) NOT LIKE '%STAND%'
  </code></pre>
  
  <p>This code pulls through the price lists for all products currently, except for our product range with +p included in the title? I'm enquiring what needs to be done to the current code to include the product range with +p? as this needs to be included.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Kind Regards
  Dean Gent</p>