It's known that you can create aliases in SELECT commands using statements, like IF and CASE, including using referring them in WHERE clauses (which is not supported in SQLServer, for example). However I'm getting a really weird behavior when executing this command:
If you execute it without the WHERE clause both aliases will be selected as 1, correctly. However, when trying to filter by the second parameter, Ultralite gets lost. It seems it doesn't recognize the first alias, reading it as 0 instead of its value 1.
Is this a bug or a limitation? Because we use this feature a lot, but this is the first time we use it in a second level (the WHERE clause uses an alias which is generated using a condition using another alias)
Ps: Sorry about the question name and description (the terms can be a little bit confusing), but I was not sure how I could explain it properly...
Thank you for reporting this.
I have reproduced a problem. It appears that evaluation of the where clause is incorrect in some cases here, which leads to incorrect results.
(As a workaround, can you generate the condition directly in the where clause?)