Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Statement
Message
From
02/08/2001 18:34:12
N. Lea
Nic Cross Enterprises
Valencia, California, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
SQL Statement
Miscellaneous
Thread ID:
00539134
Message ID:
00539134
Views:
60
In this line for a SQL-Statement:

SELECT report_1 AS report_1, ;
reportnames.descript + "total" AS descript, ;
IIF(I_L = "I",(Total,Total)*-1) AS Total, ;
printorder AS printorder, ;
groupcode AS groupcode, ;
"X" AS I_L ;
FROM Report1 ;
GROUP BY Groupcode ;
ORDER BY I_L ;
INTO CURSOR SummaryTable

The line:
IIF(I_L = "I",Amount,Amount*-1) AS Amount

I am trying to use it to do a calculation into a cursor. However, I upon looking at it, it will only do the income fields and not expense fields. I tried setting a filter, but it did not work.

The tables look like:
DESCRIPTION CODE AMOUNT groupcode I_L

DVD INCOME 410 50000 10 I
DVD LOSS 510 10000 10 L
VHS INCOME 420 50000 20 I
VHS LOSS 520 60000 20 L
ADMINISTRATIVE 610 40000 60 I
SALES 710 30000 60 I

and I need the calculations into a summary table to look like:

DESCRIPTION CODE AMOUNT groupcode I_L

DVD TOTAL 40000 10 X
VHS TOTAL -10000 20 X
OFFICE TOTAL 70000 60 X

but my calculations are always off. not to mention my description. Any tips?

Thanks
Next
Reply
Map
View

Click here to load this message in the networking platform