leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1251.sql (233B)


      1 SELECT P.product_id, IFNULL(ROUND(SUM(price * units) / SUM(units), 2), 0) AS average_price
      2 FROM Prices P
      3 LEFT JOIN UnitsSold U
      4 ON P.product_id = U.product_id AND
      5    purchase_date BETWEEN start_date AND end_date
      6 GROUP BY P.product_id