SQLTeam.com | Weblogs | Forums

Design of Sql Query - Sum of Original Amount and Remaining Amt


#1

Pl. assist me in designing of sql query as per following details:-
Cust. Ledger Entry

  1. Entry No.
  2. Posting Date
  3. Customer No.
  4. Document No.
  5. Date Filter
  6. Original Amt. (LCY)
  7. Remaining Amt (LCY)
    Innter Join (Cust. Ledger Entry.Entry No. = Detailed Cust. Ledg. Entry.Entry No.)
    Detailed Cust. Ledg. Entry
  8. Entry No.
    The value of Cust. Ledger Entry.Original Amt.(LCY) should be sum of Detailed Cust. Ledg. Entry.Amount(LCY)
    WHERE
    Detailed Cust. Ledg. Entry.Cust. Ledger Entry No. = Cust. Ledger Entry.Entry No.
    AND
    Detailed Cust. Ledg. Entry.Entry Type = Cust. Ledger Entry.Initial Entry
    AND
    Detailed Cust. Ledg. Entry.Posting Date = Cust. Ledger Entry.Date Filter

The value of Cust. Ledger Entry.Remaining Amt LCY) should be sum of Detailed Cust. Ledg. Entry.Amount(LCY)
WHERE
Detailed Cust. Ledg. Entry.Cust. Ledger Entry No. = Cust. Ledger Entry.Entry No.
AND
Detailed Cust. Ledg. Entry.Posting Date = Cust. Ledger Entry.Date Filter

Fields to be displayed as
Posting Date, Customer No., Document No., Original Amt. (LCY), Remaining Amt (LCY)


#2

Please supply consumable test data and the results you'd like to see based on that test data.