按部门进行层次分组时的汇总问题.急,分不够可以再加

cynthia8 2005-04-05 11:25:53
我现在有个部门表,我按照部门dept_id进行层次分组,它的父ID是fath_id。分好组之后,我希望按照部门进行薪资汇总,但父部门的薪资是它下级部门和当前部门的薪资和。
例如:管理处的下级部门包括财务部和资讯部。那管理处的薪资应该是
管理处的薪资和+财务部的薪资和+资讯部的薪资
...全文
163 4 打赏 收藏 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
cynthia8 2005-04-06
  • 打赏
  • 举报
回复
select * from sly_monthsum where work_id in(select a.work_id from tblhr_employee a join func_dept('TJ_A', 1) b on a.dept_id=b.dept_id)
sql语句中的'TJ_A'我希望传一个参数进去在水晶报表中该如何实现
silverseven 2005-04-06
  • 打赏
  • 举报
回复
select * from sly_monthsum where work_id in(select a.work_id from tblhr_employee a join func_dept('TJ_A', 1) b on a.dept_id=b.dept_id)
sql语句中的'TJ_A'我希望传一个参数进去在水晶报表中该如何实现

select * from sly_monthsum where work_id in(select a.work_id from tblhr_employee a join func_dept('TJ_A', 1) b on a.dept_id=b.dept_id)
sql语句中的'TJ_A'我希望传一个参数进去在水晶报表中该如何实现

select * from sly_monthsum where work_id in(select a.work_id from tblhr_employee a join func_dept('TJ_A', 1) b on a.dept_id=b.dept_id)
sql语句中的'TJ_A'我希望传一个参数进去在水晶报表中该如何实现

select * from sly_monthsum where work_id in(select a.work_id from tblhr_employee a join func_dept('TJ_A', 1) b on a.dept_id=b.dept_id)
sql语句中的'TJ_A'我希望传一个参数进去在水晶报表中该如何实现

landlordh 2005-04-05
  • 打赏
  • 举报
回复
fath_id组
dept_id组
.......
汇总
汇总
cynthia8 2005-04-05
  • 打赏
  • 举报
回复
这样是可以,但是fath_id那个部门会在组视图中显示两次。造成数据重复。我原来是只有一个分组。即按dept_id分组。只按dept_id分组,可不可以实现实现我上面说的。

4,818

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 图表区
社区管理员
  • 图表区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧