日期:2014-05-17 浏览次数:20997 次
sql="select a.ID as DID," sql=sql&" IsNull(sum(b.Signing_AmountIN),0) as q1a," sql=sql&" IsNull(sum(c.Signing_AmountIN),0) as q2a" sql=sql&" from KL_Depart as a" sql=sql&" left join KL_Signing b" sql=sql&" on b.DepartID = a.ID" sql=sql&" and b.Signing_Stage = 3 and b.UnitID = "&KL_UnitID&" and b.Signing_UseDate between '"&CDate(BDate)&"' and '"&CDate(BDate2)&"'" sql=sql&" left join KL_Signing c" sql=sql&" on c.DepartID = a.ID" sql=sql&" and c.Signing_Stage = 3 and c.UnitID = "&KL_UnitID&" and c.ISCheckD = 1 and c.Signing_UseDate between '"&CDate(BDate)&"' and '"&CDate(BDate2)&"'" sql=sql&" where a.UnitID ="&KL_UnitID&" and a.ISWriteOFF = 0" sql=sql&" group by a.ID" sql=sql&" order by q1a desc"