Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using the ICASE function
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01514002
Message ID:
01514004
Views:
109
This message has been marked as the solution to the initial question of the thread.
>There is supposedly a parentheses missing according to the compiler. All was well until I added an ICASE() function.
>
>
>	SELECT ;
>			d.GrpName, ;
>			d.GrpID, ;
>			d.Emp_ID, ;
>			d.BnftName, ;
>			SUM(d.bill_prem) AS Month_Billed, ;
>			SUM(d.cash_paid) AS Month_Collected, ;
>			ICASE(d.Bill_Mode="M", SUM((d.Bill_prem) * 12, ;
>				d.Bill_Mode="Q", SUM(d.Bill_Prem) * 4, ;
>				d.Bill_Mode="S", SUM(d.Bill_Prem) * 2, ;
>				d.Bill_Mode="A", SUM(d.Bill_Prem), ;
>				SUM(d.Bill_Prem) * 12) AS Annual_Prem, ;
>			l.Lives ;
>		FROM curDataDetail d;
>		JOIN tmpLives l ON d.GrpID = l.GrpID ;
>		WHERE BETWEEN(d.dBilling, ldFirstDateOfMonth, ldLastDateOfMonth) ;
>		GROUP BY GrpName, d.GrpID, d.Emp_ID, d.BnftName, l.Lives ;
>		INTO CURSOR ("tmp" + ALLTRIM(STR(lnMonth)))
>
You have an extra left paren in the first SUM in the ICASE.

BTW, the way I figure these out is to start at 0 counting, adding 1 for each left paren and subtracting 1 for each right parent. If I don't end at 0, I know something's wrong.

Tamar

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform