Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2008

    Unanswered: Generate Query to Show Ledger Account

    I have 3 Table
    1) Customer Master, with field Code,OpeningBalance, ClosingBalance
    2) Sales_Details, with field Code,SalesDate,Quantity,Rate,Amount
    3) Collection_Details, with field Code,PaymentDate,AmountReceived

    I want to generate Ledger Account of 1 Customer at a time using his CustomerCode,common field in all 3 Table
    Like i want OpeningBalance, Quantity, Rate Amount, AmountReceived,CurrentBalance from this 3 Table,
    I had run query using Left Outer Join But it is giving me Duplicate record of sales & Payment table,
    Her i am sending my query to you, Please give me proper advice to solve problem

    Select A.DukandarName,A.OpeningBalance,B.AmountReceived,C .Quantity,C.Rate,C.Amount As TotalSales_Amount,A.CurrentBalance
    from DukandarMaster As A Left Outer Join
    Collection_Details As B on A.Dukandarcode=B.Dukandarcode
    Left Outer Join
    Sales_Details As C On A.Dukandarcode=C.Dukandarcode
    And B.Dukandarcode=A.Dukandarcode
    Left Outer Join
    DalalMaster As D On C.DalalName = D.DalalName
    Where A.Dukandarcode='11'
    Group By A.DukandarName,A.OpeningBalance,
    C.Amount ,A.CurrentBalance

  2. #2
    Join Date
    Jun 2004
    Long Island
    Why are you grouping if you are not aggregating ? To get distinct rows ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts