SQL查询:以10为间隔显示转账金额的分布

时间:2021-07-05 13:53:16

标签: mysql sql

表结构如下: enter image description here

需要以下格式的输出 enter image description here

1 个答案:

答案 0 :(得分:0)

您可以尝试以下方法:

SELECT bin, sum(amount) FROM ( SELECT TRUNCATE(transfer_amount, -1) as bin , transfer_amount as amount FROM table) Group BY bin