请帮忙把以下MS SQL查询语句转换为ACCESS里对应查询语句(转对者50分相送)(50分)

  • 主题发起人 主题发起人 nylx
  • 开始时间 开始时间
N

nylx

Unregistered / Unconfirmed
GUEST, unregistred user!
MS SQL语句:<br>select distinct d.dept,yd.ydrs,sd.sdrs,zh.zjrs,jj.jjrs<br>from department d<br>--按部门统计应到人数<br>left join<br> &nbsp;(select d.dept,count(p.emno) as ydrs from person p<br> &nbsp; &nbsp; left join department d on d.dpno=p.dpno<br> &nbsp; &nbsp; &nbsp; group by d.dept) yd on d.dept=yd.dept<br>--安部门统计实到人数<br>left join<br> &nbsp;(select d.dept,count(distinct p.emno) as sdrs from person p<br> &nbsp; &nbsp; left join department d on d.dpno=p.dpno<br> &nbsp; &nbsp; left join attendance a on a.emno=p.emno<br> &nbsp; &nbsp; &nbsp; where a.adate!='' and a.atime!=''<br> &nbsp; &nbsp; &nbsp; group by d.dept) sd on d.dept=sd.dept<br>--按部门统计直接人员数<br>left join<br> &nbsp;(select d.dept,count(p.zhj) as zjrs from person p<br> &nbsp; &nbsp; left join department d on d.dpno=p.dpno<br> &nbsp; &nbsp; &nbsp; where p.zhj='直接'<br> &nbsp; &nbsp; &nbsp; group by d.dept) zh on d.dept=zh.dept<br>--按部门统计间接人员数<br>left join <br> &nbsp;(select d.dept,count(p.zhj) as jjrs from person p<br> &nbsp; &nbsp; left join department d on d.dpno=p.dpno<br> &nbsp; &nbsp; &nbsp; where p.zhj='间接'<br> &nbsp; &nbsp; &nbsp; group by d.dept) jj on d.dept=jj.dept
 
如果确实要转换,不如在ACCESS里创建查询,等同于SQL里的视图.
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
928
SUNSTONE的Delphi笔记
S
后退
顶部