question

Purushotham T R avatar image
0 Likes"
Purushotham T R asked Jeanette F commented

FLEXSIM SQL QUERY ISSUE

In this Case_function_sql.fsm i am trying to use SQL CASE THEN END Functions but query is getting error please tell the reason for this

FlexSim 23.0.0
process flow
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Purushotham T R, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered

You have an empty WHERE statement and the syntax for the CASE statement is also incorrect. Personally, I often use w3schools.com to look up SQL syntax when I'm not sure about to utilize a statement.

I don't know what the intend for your query is (it seems you want to return "Cavities" in either case ?), but a correct query string would look like this:

"SELECT * FROM GlobalTable1 ORDER BY (CASE WHEN Test == 'F' THEN Cavities WHEN Test == 'M' THEN Cavities END)"

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.