title: SQL Query to generate balance
body: <p>I have one table named LedgerReport which contain customer name,sales bill number and amount and i have to generate the <strong>balance</strong> of customer wise one by one row without using the cursors </p>
  
  <p>and i hav send u the sample report below so please send me some suggestion to solve my problem...</p>
  
  <pre><code>Create Table LedgerReport 
  (
      Customer Nvarchar(64),
      Billno Nvarchar(64),
      Amount Decimal (10,3)
  )
  
  Insert Into LedgerReport Values ('Prem','Sb-001','5000')
  Insert Into LedgerReport Values ('Prem','Sb-002','7000')
  Insert Into LedgerReport Values ('Prem','Sb-003','2000')
  Insert Into LedgerReport Values ('Prem','Sb-004','8000')
  Insert Into LedgerReport Values ('Biswo','Sb-005','2000')
  Insert Into LedgerReport Values ('Biswo','Sb-006','3000')
  Insert Into LedgerReport Values ('Biswo','Sb-007','4000')
  Insert Into LedgerReport Values ('Biswo','Sb-008','5000')
  </code></pre>
  
  <p>&nbsp;</p>
  
  <pre><code>Select * from LedgerReport
  ------------------------------------------------
  Customer  BillNo     Amount    **Balance**  
  ----------------------------------------------
  Prem      Sb-001   5000.000   **5000.000**
  Prem      Sb-002   7000.000  **12000.000**
  Prem      Sb-003   2000.000  **14000.000**
  Prem      Sb-004   8000.000  **22000.000**
  Biswo     Sb-005   2000.000   **2000.000** 
  Biswo     Sb-006   3000.000   **5000.000**
  Biswo     Sb-007   4000.000   **9000.000**
  Biswo     Sb-008   5000.000  **14000.000**
  </code></pre>