Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
RoniDxb
Starting Member
28 Posts |
Posted - 2008-08-02 : 14:10:20
|
View LedgerSr.....Debit.......Credit.....Balance.1......100.........0..........100.....2......100.........0..........200.....3......0...........50.........150.....4......100.........0..........250.....We can only enter Sr, Debit and Credit where Balance Column should be automatically calculate in the View.Note Balance = Debit - Credit + Balance(of last row)plz help mePlz note Table Ledger only have Cols ( Sr, Debit and Credit) |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-02 : 14:24:06
|
[code]UPDATE tSET t.Balance=(SELECT SUM(Debit)-SUM(Credit) FROM YourTable WHERE Sr<=t.Sr)FROM YourTable t[/code] |
 |
|
RoniDxb
Starting Member
28 Posts |
Posted - 2008-08-02 : 14:37:25
|
quote: Originally posted by visakh16
UPDATE tSET t.Balance=(SELECT SUM(Debit)-SUM(Credit) FROM YourTable WHERE Sr<=t.Sr)FROM YourTable t
Thanks Visakh for ur kind cooperationPlz noteBalance columne is not include in above tableBalance column is only include in The view.what will be the code in case of view. plz guide me |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-02 : 14:43:27
|
[code]CREATE VIEW YourViewASSELECT Sr, Debit, Credit, (SELECT SUM(Debit)-SUM(Credit) FROM YourTable WHERE Sr<=t.Sr) AS BalanceFROM YourTable tGO[/code] |
 |
|
RoniDxb
Starting Member
28 Posts |
Posted - 2008-08-02 : 14:55:17
|
Thanks Visask my problem is solved. thanks again |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-02 : 15:00:44
|
You're welcome |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-08-04 : 04:43:03
|
If you want to show data in Reports, make use of it's Running Total featureMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|