1,账单表结构
id money create_date
1 10 2016-11-11
2 20 2016-11-12
2,需求是按日期排序,查询总金额<=1000元的账单列表数据
怪我咯2017-04-17 16:04:34
select t.sum_money,t.date from (sum(money) as sum_money,create_date as date from tablename group by create_date) t order by t.date;
PHP中文网2017-04-17 16:04:34
お金が合計金額の場合、
SELECT id, Money, create_date
FROM TABLE
WHERE Money <= 1000
ORDER BY create_date DESC
伊谢尔伦2017-04-17 16:04:34
select sum(money) sums,create_date from talbe group by create_date having sums<=1000 order by create_date;