7,712
社区成员
发帖
与我相关
我的任务
分享
SELECT wl_per_project.prj_id, wl_per_project.username, wl_per_project.prj_name, wl_per_project.month, wl_per_project.year, worklog.agocost
FROM wl_per_project INNER JOIN [select username,prj_id,format(prj_date,'yyyy-mm') as newyear, sum(prj_cost_time) as agocost from worklog where datediff('d',Cdate(worklog.prj_date),'2013-9-1')>0 and worklog.username in (select wl_check.username from wl_check,userinf where confirm='1' and datediff('d',Cdate(year & '-' & month & '-' & '01'),'2013-9-1')>0 and wl_check.username=userinf.username and userinf.userdept='开发部') group by username,prj_id,format(prj_date,'yyyy-mm')]. AS worklog ON (wl_per_project.username=worklog.username) AND (wl_per_project.prj_id=worklog.prj_id) AND (wl_per_project.year & '-' & format(wl_per_project.month,'0#')=worklog.newyear)
WHERE datediff('d',Cdate(wl_per_project.year & '-' & wl_per_project.month & '-' & '01'),'2013-9-1')>0 and wl_per_project.prj_id in('1','2','3','4','5');
select username,prj_id,format(prj_date,'yyyy-mm') as newyear, sum(prj_cost_time) as agocost
from worklog
where datediff('d',Cdate(worklog.prj_date),'2013-9-1')>0 and worklog.username
in
(select wl_check.username
from wl_check,userinf
where confirm='1' and datediff('d',Cdate(year & '-' & month & '-' & '01'),'2013-9-1')>0 and wl_check.username=userinf.username and userinf.userdept='开发部')
group by username,prj_id,format(prj_date,'yyyy-mm')
条件一多,我就不好用了