Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can you nest CASE statements in SPT for SQL 7
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00258343
Message ID:
00258796
Views:
9
You are right! You can nest CASE statements. After I got your message, I went back and played with it a little more and came up with the following which worked:

CASE field1
WHEN 'A' THEN
CASE field2
WHEN 0 THEN field3*(field4/100)
ELSE field3*(field5/100) END
ELSE CASE field6
WHEN 0 THEN field3*(field7/100)
ELSE field3*(field7/100) END
END AS amt_paid

I had to move the 'AS amt_paid' to the end of the top level CASE statement -- and not use it on the nested case statements.

Thanks for the response -- we are going to need this for many of our reports!
Doug
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform