我有以下数据,我正在尝试查找每月最大值的交易,然后将每个月的最大值总和与每个客户相对应,并显示最终结果。
1,2008-04-10,111,300
2,2008-04-09,112,400
3,2008-04-04,111,950
4,2008-05-01,113,900
5,2008-05-05,113,1100
6,2009-05-03,112,1200
7,2009-07-02,111,1700
8,2009-07-09,111,2000
9,2009-07-03,112,1250
10,2009-07-01,112,1150
我的查询是
select
o.Date, max(o.amount) from sample o
join
player c on o.player = c.player
group by o.player;
结果应该是这样的
2008-04-04 950
2008-05-03 1200
2009-07-09 2000
和
111 1250
113 2000
我可以暂时存储第一个查询的结果以获取第二个查询的结果吗?