mysql查询count数据是decimal,用python转换json格式的时候会报错,在查询的时候处理成无符号型,用cast
查询出来countNum是Decimal
SELECT gid, SUM(number) countNum FROM `gift_tb` WHERE tid="1" GROUP BY gid
转换成无符号型
SELECT gid, CAST(SUM(number) AS SIGNED ) AS countNum FROM `gift_tb` WHERE tid="1" GROUP BY gid