5,889
社区成员
发帖
与我相关
我的任务
分享SELECT BD.*
FROM Business_duebill BD
left join Classify_Record CR on CR.ObjectNo = DB.SerialNO
where DB.SerialNO is nullselect BD.SerialNo
,BD.CustomerID
,BD.CustomerName
,getBusinessName(BD.BusinessType) as BusinessTypeName
,BD.BusinessSum
,BD.Balance,BD.OperateUserID
,BD.OperateOrgID
,getUserName(BD.OperateUserID) as OperateUserName
,getOrgName(BD.OperateOrgID) as OperateOrgName
from BUSINESS_DUEBILL BD
left join (
select ObjectNo
from CLASSIFY_RECORD CR
where finishdate is not null
and CR.ObjectType='BusinessDueBill'
and AccountMonth='2011/03'
) CR on CR.ObjectNo = BD.SerialNO
where BD.BusinessType like '1%'
and BD.BusinessType not like '1020%'
and BD.PutOutDate < '2011/03/32'
and BD.balance >0
and CR.ObjectNo is null
and BD.OPERATEORGID in (
select BelongOrgID from ORG_BELONG where OrgID = '1000'
)select BD.SerialNo
,BD.CustomerID
,BD.CustomerName
,getBusinessName(BD.BusinessType) as BusinessTypeName
,BD.BusinessSum
,BD.Balance,BD.OperateUserID
,BD.OperateOrgID
,getUserName(BD.OperateUserID) as OperateUserName
,getOrgName(BD.OperateOrgID) as OperateOrgName
from BUSINESS_DUEBILL BD
left join (
select ObjectNo
from CLASSIFY_RECORD CR
where finishdate is not null
and CR.ObjectType='BusinessDueBill'
and AccountMonth='2011/03'
) CR on CR.ObjectNo = BD.SerialNO
where BD.BusinessType like '1%'
and BD.BusinessType not like '1020%'
and BD.PutOutDate < '2011/03/32'
and BD.balance >0
and BD.SerialNo is null
and BD.OPERATEORGID in (
select BelongOrgID from ORG_BELONG where OrgID = '1000'
)select BD.SerialNo
,BD.CustomerID
,BD.CustomerName
,getBusinessName(BD.BusinessType) as BusinessTypeName
,BD.BusinessSum
,BD.Balance,BD.OperateUserID
,BD.OperateOrgID
,getUserName(BD.OperateUserID) as OperateUserName
,getOrgName(BD.OperateOrgID) as OperateOrgName
from BUSINESS_DUEBILL BD
where BD.BusinessType like '1%'
and BD.BusinessType not like '1020%'
and BD.PutOutDate < '2011/03/32'
and BD.balance >0
and BD.OPERATEORGID in (
select BelongOrgID from ORG_BELONG where OrgID = '1000'
)
select BD.SerialNo,BD.CustomerID,BD.CustomerName,getBusinessName(BD.BusinessType) as BusinessTypeName, BD.BusinessSum,BD.Balance,BD.OperateUserID,BD.OperateOrgID, getUserName(BD.OperateUserID) as OperateUserName, getOrgName(BD.OperateOrgID) as OperateOrgName
from BUSINESS_DUEBILL BD
left join (select ObjectNo from CLASSIFY_RECORD CR where finishdate is not null and CR.ObjectType='BusinessDueBill' and AccountMonth='2011/03') CR on CR.ObjectNo = BD.SerialNO
where (BD.BusinessType like '1%' and BD.BusinessType not like '1020%')
and BD.PutOutDate < '2011/03/32' and BD.balance >0
and BD.SerialNo is null
and BD.OPERATEORGID in (select BelongOrgID from ORG_BELONG where OrgID = '1000')