I came across an issue and wanted to see if someone else had figured this out. I'd like to embed SQL select statements within a case statement so that a calculated field can execute a different SQL select statement based on the case conditions. In psuedo code:
Case
When [@Virtualfield1] = 'Option1' then
Select count(Column1) from tbl1
Else
Select count(Column2) from tbl1
End
Anyone else find a way to embed a calculation (or SQL statement) within a case statement? My objective here is to run different SQL queries based on the case statement.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
EvSam
Hello caspio universe!
I came across an issue and wanted to see if someone else had figured this out. I'd like to embed SQL select statements within a case statement so that a calculated field can execute a different SQL select statement based on the case conditions. In psuedo code:
Case
When [@Virtualfield1] = 'Option1' then
Select count(Column1) from tbl1
Else
Select count(Column2) from tbl1
End
Anyone else find a way to embed a calculation (or SQL statement) within a case statement? My objective here is to run different SQL queries based on the case statement.
Thanks for your advice!
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.