I have two cursors like this.
Now I want to combine these two into one cursor with all records without duplicating.
How can I do this?
Thank you
Code:
stra="SELECT vAcp_InvDtl.nPoDtlID,vAcp_InvDtl.nBatchInvId,Acp_AdvancePayment.cUpdatedby as cUser ,Acp_AdvancePayment.cBatchNo,Acp_AdvancePayment.nAdvanceNumber,Acp_AdvancePayment.dAdvanceDate,"
stra=stra+" Acp_AdvancePayment.cPaymentNumber,Acp_AdvancePayment.cPaymentCurr as cBatchCurr ,Acp_AdvancePayment.nPaymentValue as nAdvanceValue ,"
stra=stra+" vAcp_InvDtl.cSuplName as cSupplier ,vAcp_InvDtl.cFtyCD as cFact ,vAcp_InvDtl.cOrderType as cType "
stra=stra+" FROM MAS.dbo.Acp_AdvancePayment inner join MAS.dbo.vAcp_InvDtl on Acp_AdvancePayment.cBatchNo=vAcp_InvDtl.cBatchNo "
stra=stra+"where Acp_AdvancePayment.dAdvanceDate>= ?thisform.txtFrom.Value AND Acp_AdvancePayment.dAdvanceDate<= ?thisform.txtTo.Value and "
stra=stra+" vAcp_InvDtl.cOrderType=?thisform.cboOrderType.value "
stra=stra+" group by Acp_AdvancePayment.cUpdatedby,Acp_AdvancePayment.cBatchNo,Acp_AdvancePayment.nAdvanceNumber,Acp_AdvancePayment.dAdvanceDate,vAcp_InvDtl.nPoDtlID,"
stra=stra+" Acp_AdvancePayment.cPaymentNumber,Acp_AdvancePayment.cPaymentCurr,Acp_AdvancePayment.nPaymentValue,vAcp_InvDtl.cSuplName,vAcp_InvDtl.cFtyCD,vAcp_InvDtl.cOrderType,vAcp_InvDtl.nBatchInvId "
stra=stra+" order by Acp_FinalPayment.cBatchNo"
SQLEXEC(hndOps,stra,'_All1')
stra="SELECT vAcp_InvDtl.nPoDtlID,vAcp_InvDtl.nBatchInvId,Acp_FinalPayment.cUpdatedby as cUser,Acp_FinalPayment.cBatchNo,Acp_FinalPayment.dPaymentDate as dAdvanceDate ,Acp_FinalPayment.cPaymentNumber ,"
stra=stra+" Acp_FinalPayment.cPaymentCurr as cBatchCurr ,Acp_FinalPayment.nPaymentValue as nAdvanceValue , "
stra=stra+" vAcp_InvDtl.cSuplName as cSupplier ,vAcp_InvDtl.cFtyCD as cFact ,vAcp_InvDtl.cOrderType as cType "
stra=stra+" FROM MAS.dbo.Acp_FinalPayment inner join MAS.dbo.vAcp_InvDtl on Acp_FinalPayment.cBatchNo= vAcp_InvDtl.cBatchNo where "
stra=stra+" Acp_FinalPayment.dPaymentDate>= ?thisform.txtFrom.Value AND Acp_FinalPayment.dPaymentDate<= ?thisform.txtTo.Value "
stra=stra+" group by Acp_FinalPayment.cUpdatedby,Acp_FinalPayment.cBatchNo,Acp_FinalPayment.dPaymentDate,Acp_FinalPayment.cPaymentNumber,"
stra=stra+" Acp_FinalPayment.cPaymentCurr,Acp_FinalPayment.nPaymentValue,vAcp_InvDtl.cSuplName,vAcp_InvDtl.cFtyCD,vAcp_InvDtl.cOrderType, "
stra=stra+" vAcp_InvDtl.nPoDtlID,vAcp_InvDtl.nBatchInvId "
stra=stra+" order by Acp_FinalPayment.cBatchNo"
SQLEXEC(hndOps,stra,'_All2')
How can I do this?
Thank you