Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Complicated SQL
Message
From
21/08/1999 09:42:35
Vinod Parwani
United Creations L.L.C.
Ad-Dulayl, Jordan
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00256239
Message ID:
00256243
Views:
41
>>I've 3 tables :-
>>
>>ACGLMST -> General Ledger codes,
>>Fields AcCode, Description, OpnBal
>>
>>ACTRANS -> Transaction file, Parent of Actr2,
>>Fields AcCode, Date, Amt, DrOrCr
>>
>>ACTR2 -> Child of Actrans, 1 to Many Relation,
>>Fields Actranscode, AcCode, Date, Amt, DrOrCr
>>
>
>Let's assume that DrOrCr field contains either D for Debit C for Credit
>
>You can separate DR or CR columns by: IIF(DrOrCr='D',amt,0) AS Debit, IIF(DrOrCr='C',amt,0) AS credit etc., etc.
>
>>I need report in following format
>>
>>
>>Ledger Code 1     "Scb Bank A/c"        Opening Balance 145,000.00
>>==================================================================
>>
>>AcCode   Description    Date        DrAmt       CrAmt
>>
>>12       Xyz Customer   01/01/99    50,000.00    -
>>13       Claims         15/02/99     -          1560.00
>>
>>Ledger Code 2 etc. etc.
>>
>>
>>
>>By writing a procedure, i can create a cursor, but is there any way to retrieve this info with 1 sql command only.. (which I can use in report)...
>>
>>TIA

Thnks for your reply.. i'm aware that iif can be used here but how to get this whole info. in cursor in one sql statement...

Pls advs..
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform