这是我的SQL
:
SELECT * FROM (SELECT sk, SUM(qty) AS cnt FROM order WHERE sk LIKE '%s%s' AND days <= '%s' GROUP BY sk ORDER by cnt DESC) AS tmp WHERE tmp.cnt >3;
这是我的代码:
result = cur.fetchall()
for sk, cnt in result:
rat = cnt/total
然后我得到一个错误:
TypeError: unsupported operand type(s) for /: 'str' and 'Decimal'
我不知道为什么cnt
是 typestr
而不是int
.