Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Balance amt using SQL from Parent-Child and GrandMaster
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
00966900
Message ID:
00967050
Views:
15
Hi Sergey

I had been working on your code in the mean time. I have narrowed it down to the following;
SELECT 'Accounts J.V.            ' AS cFlag, t.iID, t.cBk, t.iNo, t.dDt,
        s.bDrAmt,
        s.bCrAmt,
        uf.bDr, uf.bCr,
        s.bDrAmt + uf.bDr - uf.bCr AS bBalDr,
        s.bCrAmt + uf.bCr - uf.bDr AS bBalCr
    FROM tAccountsJV t
    JOIN sAccountsJV s
        ON s.iPID = t.iID
            AND s.iAcctID = 485
    LEFT JOIN uOSAccounts uf
        ON uf.iPID = t.iID OR uf.iSID = t.iID
This returns 2 rows but the problem is either bBalDr or bBalCr is right but the other in the same row is wrong dues to the kind of calculation. I tried a IIF() in FireBird but that is not available. Any idea to improve this SQL?

Appreciating your help.
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform