我有下表(daus 表示每日活跃用户):
CREATE TABLE IF NOT EXISTS`daus` (
// ... other fields
`date` date NOT NULL,
`daus` int NOT NULL,
`earned` float NOT NULL,
`currency` varchar(20) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
和这样的查询:
SELECT `currency`, SUM(`daus`) as `totalDAUs`, SUM(`earned`) as `totalEarned` FROM daus WHERE date BETWEEN ? AND ? GROUP BY `currency` ORDER BY `currency`
我回到以下行:
[ TextRow { currency: 'CAD', totalDAUs: '4986', totalEarned: 4970 } ]
为什么是totalDAUs
字符串而不是数字?我能看到的唯一区别是它是一个 int 字段而不是一个浮点数,但我不认为这很重要。