You're right, ... but in that page it says: The only difference between the following two CASE expressions is that the x expression is evaluated exactly once in the first example but might be evaluated multiple times in the second:
CASE x WHEN w1 THEN r1 WHEN w2 THEN r2 ELSE r3 END CASE WHEN x=w1 THEN r1 WHEN x=w2 THEN r2 ELSE r3 END So, my understanding is that the second CASE (for my example) should give the same result as the first CASE. -----Original Message----- From: Constantine Yannakopoulos Sent: Tuesday, October 07, 2014 1:36 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Is there equivalent to MySQL IF() function? On Tue, Oct 7, 2014 at 1:13 PM, Tony Papadimitriou <to...@acm.org> wrote: > As you can see, the second select gives unexpected output, and according > to the syntax diagram it's not supposed to be a valid variation of the CASE > statement. Is that normal? http://www.sqlite.org/sessions/lang_expr.html Looks perfectly valid. "expr" can be any expression, including logical ones such as "a < 10". Logical expressions in SQLite are just like any other expressions and evaluate to 0 or 1. For example, it is perfectly legal to SELECT a.a < 10 FROM a _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users