Guest User

Untitled

a guest
May 27th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. DECLARE @rfFMSupplier_EBILL NUMERIC(12,0)
  2.  
  3. SET @rfFMSupplier_EBILL = (
  4. SELECT s.rfFMSupplier
  5. FROM FMSupplier s
  6. , BPBillingType bt
  7. WHERE BT.txBrief = 'EBILLW'
  8. AND S.rfFMSupplier = BT.rfFMSupplier)
  9.  
  10.  
  11. -- Get a List of Candidate Customers (restrict to EBILL type customers)
  12. INSERT INTO #Cust(rfFMCustomer)
  13. SELECT DISTINCT C.rfFMCustomer
  14. FROM FMCustomer C
  15. , BPCustomerBillingPeriod CBP
  16. , BPInvoice I
  17. WHERE CBP.rfFMCustomer = C.rfFMCustomer
  18. AND CBP.daEffective BETWEEN '01-JAN-2007' AND '01-AUG-2008'
  19. AND I.rfBPCustomerBillingPeriod = CBP.rfBPCustomerBillingPeriod
  20. AND I.rfFMSupplier = @rfFMSupplier_EBILL
Add Comment
Please, Sign In to add comment