gpt4 book ai didi

MySQL:我想汇总我的员工成本并按员工和日期进行分组

转载 作者:行者123 更新时间:2023-11-29 09:06:30 25 4
gpt4 key购买 nike

我目前有一个表格,用于记录所有员工的日常开支

John Smith    01 JAN 2010    200$ 
John Smith 01 JAN 2010 50$
John Smith 01 JAN 2010 10$
Lady Gaga 01 JAN 2010 50$
Lady Gaga 01 JAN 2010 20$
John Smith 02 JAN 2010 10$

我想显示一个包含所有账单每日报告的表格:

01 JAN 2010
John Smith: 260$
Lady Gaga: 70$

02 JAN 2010
John Smith: 10$

我真的希望我的请求能够被理解,并且您能够帮助我。

非常感谢您的建议!

最佳答案

我会使用标准分组依据:

select date, name, sum(amount) as total
from mytable
group by 1,2
order by 1,2;

关于MySQL:我想汇总我的员工成本并按员工和日期进行分组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6898454/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com