select sum(salary.salary), dept from salary, staff
where salary.staffid = staff.staffid and salary.[date] = '2010-7-2'
group by staff.dept
求一个sql语句,统计各部门今年7月份工资总和
求一个sql语句,统计各部门今年7月份工资总和
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)