查询每个用户指定月份最后一天的收益

select o.AgentId ,o.Date,o.profit from agentprofit as o join (select a.AgentId,MAX(Date) as max_Date from agentprofit as a GROUP BY a.AgentId) as t on o.AgentId=t.AgentId and
o.Date=t.max_Date GROUP BY o.AgentId,o.profit

posted on 2020-02-06 16:00  落叶子  阅读(150)  评论(0编辑  收藏  举报

导航