Home Forums Programming General Need help on query when sum of total show inaccurate result RE: Need help on query when sum of total show inaccurate result

  • just a thought....it may help explain 

    SELECT c.id_product,
       SUM(COALESCE(c.received_qty, c.ordered_qty)) AS Total,
       c.id_cart,
       p.id_purchase,
       p.id_department
    FROM Cart_Item AS c
      LEFT OUTER JOIN Purchase AS p ON c.id_cart = p.id_cart
    GROUP BY c.id_product,
       c.id_cart,
       p.id_purchase,
       p.id_department;

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day