Skip to content

Instantly share code, notes, and snippets.

@purechamploo
Created August 25, 2019 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save purechamploo/0274d619b1cea89180e7b784c5cf6996 to your computer and use it in GitHub Desktop.
Save purechamploo/0274d619b1cea89180e7b784c5cf6996 to your computer and use it in GitHub Desktop.
有一个销售记录表 包含了一些如下的内容
name money date
(名称) (销售总额金额) (日期)
商品 A 100 2019 年 7 月 25 日
商品 B 200 2019 年 7 月 25 日
商品 C 300 2019 年 7 月 25 日
商品 A 6600 2019 年 7 月 24 日
商品 B 99800 2019 年 7 月 24 日
最后想实现的是:通过 select name,sum(money) from Table where date>'2019 年 7 月 23 日' group by name desc
该语句得到的数据集
商品 A 99900
商品 B 6800
商品 C 300
然后返回前端进行展示,现在卡在 sql 语句会写,但是返回类型,用什么去放这 3 条数据,我查了一下资料还是不明白,有老哥给个方案吗
我想的办法是用 List<商品> 去放,这样做是对的吗
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment