Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
General Ledger
Message
 
To
11/04/2012 04:03:09
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01540994
Message ID:
01541004
Views:
87
This message has been marked as the solution to the initial question of the thread.
>Sir,
>
>Your codes remove BALANCE in first row that is 450.
>It is opening blance and must not be deleted.
>Please see attached image.
create table test3 free (date d(8),detail c(10),vou_no n(5),debit n(9,2),credit n(9,2),balance n(10,2),dr_cr c(2))

INSERT INTO TEST3 values({},'Opening',0,0,0,450,'DR')
INSERT INTO TEST3 values({^2012-04-01},"",1,796827,0,0,'')
INSERT INTO TEST3 values({^2012-04-02},"",2,576385,0,0,'')
INSERT INTO TEST3 values({^2012-04-03},"",3,0,500000,0,'')
INSERT INTO TEST3 values({^2012-04-04},"",4,0,900000,0,'')
INSERT INTO TEST3 values({^2012-04-05},"",5,1000000,0,0,'')
INSERT INTO TEST3 values({^2012-04-06},"",6,0,972762,0,'')
INSERT INTO TEST3 values({^2012-04-07},"",7,8000,0,0,'')
INSERT INTO TEST3 values({^2012-04-07},"",7,0,90000,0,'')


SELECT Test3.date,;
       Test3.detail,;
       Test3.vou_no,;
       Test3.debit,;
       Test3.credit,;
       SUM(Tst.Balance)                      AS Balance,;
       IIF(SUM(Tst.Balance) < 0, "CR", "DR") AS dr_cr;
FROM Test3;
LEFT JOIN (SELECT Debit-Credit+Balance AS Balance, Date FROM Test3) Tst ON Test3.Date >= Tst.Date;
GROUP BY Test3.date,;
       Test3.detail,;
       Test3.vou_no,;
       Test3.debit ,;
       Test3.credit
       
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform