SQL: Query for Top Selling Products in February
\n# Code\n\nWITH topSalesProductsInFeb AS (\n    SELECT \n        product_id AS id, \n        SUM(unit) AS total_units\n    FROM orders\n    WHERE order_date BE
\n# Code\n```\nWITH topSalesProductsInFeb AS (\n    SELECT \n        product_id AS id, \n        SUM(unit) AS total_units\n    FROM orders\n    WHERE order_date BETWEEN \'2020-02-01\' AND \'2020-02-29\'\n    GROUP BY product_id\n    HAVING SUM(unit) >= 100\n)\n\nSELECT \n    p.product_name, \n    ts.total_units AS unit\nFROM products p\nINNER JOIN topSalesProductsInFeb ts ON p.product_id = ts.id;\n\n```\n\n![upvote_leetcode.png](https://assets.leetcode.com/users/images/384e4c6f-586f-4d51-8f52-1bf17c594f5e_1704481037.9093456.png)\n
['MySQL']