sql查询单个项目的全年总和,按月份统计怎么实现?
select sum(salary.salary), dept from salary, staff
where salary.staffid = staff.staffid and salary.[date] = "2010-7-2"
group by staff.dept
select m.dept , convert(varchar(7),n.date,120) yue, sum(n.salary)
from staff m, salary n
where m.staffid = n.staffid and month(n.date) = 7
group by m.dept , convert(varchar(7),n.date,120)
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇:没有了
