查询
sqlstr="select 表1.员工姓名,表2.部门名称,sum(表3.加班天数),sum(表4.休假天数),上季度转化来的假期
form 表1,表2,表3,表4,表5
where 表1.部门代码=表2.部门代码
and 表1.员工代号=表2.员工代号(指的是查询条件要求查询的人的代号)
and 表3.员工代号=表1.员工代号
and 表4.员工代号=表1.员工代号
and 表5.员工代号=表1.员工代号"
季度结算:
首先查询上次结算日期,判断需不需要结算,如果需要:
objRs.open "select * from 表1",conn,3,3
for i=1 to objRs.recordcount
if objRs.eof then
exit for
else
Id = objRs("pID")
objRs2.open "select sum(表3.加班天数)-sum(表4.休假天数)+上季度转化来的假期
from 表1,表3,表4,表5 where and 表3.员工代号=表1.员工代号
and 表4.员工代号=表1.员工代号
and 表5.员工代号=表1.员工代号
and 表1.pID="& objRs("pID"),conn,3,3
spare = objRs2(1)
if spare>10 then spare=10
objRs2.open "select * from 表5 where 表5.员工代号="& Id
objRs2.Addnew
objRs2("员工代号") = Id
objRs2("上季度转化来的假期") = spare
objRs2("结算日期") = new()
objRs2.updata
objRs2.open "delete from 表4,表3
where and 表3.员工代号='"&Id&"'
and 表4.员工代号='"&Id&"'"
end if
objRs.NextMove
next