入门客AI创业平台(我带你入门,你带我飞行)
博文笔记

sql查询单个项目的全年总和,按月份统计怎么实现?

创建时间:2017-06-28 投稿人: 浏览次数:1349



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。
  • 上一篇:没有了
  • 下一篇:没有了
未上传头像