title: Reduce computer prices by 20 percent and also all products with more than 4 offers
body: <p>I need to "Reduce computer prices by 20 percent and also all products with more than 4 offers"</p>
  
  <p>I have the following query and the math comes out wrong but is similar to the output.</p>
  
  <pre><code>SELECT 
      o.supp_id, p.prod_id, 
      CAST(ROUND(SUM(o.price * .80), 3) AS FLOAT) as 'Price', 
      o.Quantity
  FROM
      tb_product p, tb_offers o
  WHERE 
      p.name = 'computer'
      AND p.prod_ID = o.prod_ID
  GROUP BY
      o.supp_id, p.prod_ID, quantity
  
  UNION
  
  SELECT 
      supp_id, p.prod_id, 
      CAST(ROUND(SUM(tb_offers.price * .80), 3) AS FLOAT) as 'Price', 
      Quantity
  FROM 
      tb_product p, tb_offers
  WHERE 
      tb_offers.prod_id = p.prod_ID
  GROUP BY 
      tb_offers.supp_id, p.prod_id, quantity
  HAVING 
      COUNT(p.prod_Id) &gt; 4
  </code></pre>
  
  <p>The query above the union works out, but the one on bottom doesn't return anything (which should be the products with more more than 4 offers.</p>
  
  <p>Is the bottom query showing me the products with more than 4 offers?</p>
  
  <p>I have the following tables:</p>
  
  <pre><code>Tb_Consumer - Name, City, Con_ID 
  Tb_Supplier - Name, City, Supp_ID 
  Tb_Offers - Name, Quantity, Prod_ID, Supp_ID 
  Tb_Product - Name, Prod_ID 
  Tb_Requests - Name, Quantity, Prod_ID, Con_ID 
  Tb_Transactions- Tran_ID, Supp_ID, Con_ID, Quantity, Price
  </code></pre>