Untitled

                Never    
SQL
       
-- Server: DEVBOSQLINTC2
-- product and PO suppliers must be different
SELECT 
OpSuID,
PoSuID,
* FROM csn_credit..tblCreditRecovery R WITH (NOLOCK)
INNER JOIN csn_credit..tblOrderCredit C WITH (NOLOCK) ON C.CrID = R.CrID
INNER JOIN csn_order..tblOrderProduct WITH (NOLOCK) ON CrOpID = OpID
INNER JOIN csn_order..tblPurchaseOrder WITH (NOLOCK) ON PONum = CrPONum
WHERE PONum = 161820845 -- change the PO num based on the credit being approved
AND CrRecoveryCurrentStatusID = 27 -- Aged credit

Raw Text