Help! The query statement Table A contains the field id (auto-increment), order_id (order id), goods_sn (Product Code), and other fields... how do I write statements for the top 10 products with the largest number of product codes? Cainiao help ------ solution ------------------ SQLcodeSELECT *, count (goods_sn) ascounterFROMtable for help! Query statement
Table A contains the field id (auto-increment), order_id (order id), goods_sn (Product Code), and other fields... how do I write statements for the top 10 products with the largest number of product codes? Cainiao for help
------ Solution --------------------
SQL code
SELECT *, count (goods_sn) as counter FROM table group by goods_sn order by goods_sn desc
------ Solution --------------------
Select count (*) as ct from a order by id desc group by goods_sn;
Refer
------ Solution --------------------
SQL code
SELECT count (*) as counter FROM table group by goods_sn order by goods_sn desc limit 10