Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE @rfFMSupplier_EBILL NUMERIC(12,0)
- SET @rfFMSupplier_EBILL = (
- SELECT s.rfFMSupplier
- FROM FMSupplier s
- , BPBillingType bt
- WHERE BT.txBrief = 'EBILLW'
- AND S.rfFMSupplier = BT.rfFMSupplier)
- -- Get a List of Candidate Customers (restrict to EBILL type customers)
- INSERT INTO #Cust(rfFMCustomer)
- SELECT DISTINCT C.rfFMCustomer
- FROM FMCustomer C
- , BPCustomerBillingPeriod CBP
- , BPInvoice I
- WHERE CBP.rfFMCustomer = C.rfFMCustomer
- AND CBP.daEffective BETWEEN '01-JAN-2007' AND '01-AUG-2008'
- AND I.rfBPCustomerBillingPeriod = CBP.rfBPCustomerBillingPeriod
- AND I.rfFMSupplier = @rfFMSupplier_EBILL
Add Comment
Please, Sign In to add comment