[Here](https://www.mail-archive.com/sqlite-users@mailinglists.sqlite.org/msg94070.html) is a comment made by Richard Hipp back in 2015 on using aliased columns in a `WHERE` clause: >This is not valid SQL, actually. For clarity, here is the (invalid) >SQL reformatted: > > `SELECT a+b AS x FROM t1 WHERE x=99;` > >You are not suppose to be able to access the "x" alias within the WHERE clause. > >Yes, I know that SQLite allows this. But it does so grudgingly, for >historical reasons. It is technically not valid. Note that none of >MySQL, Oracle, PostgreSQL, nor SQLServer allow statements like the >above. > >Because the SQL is technically not valid, I am less inclined to spend >a lot of time trying to optimize it. > >I really wish there was a way for me to fix this historical >permissiveness in SQLite without breaking millions of (miscoded) >iPhone/Android apps. I'd do so if I could.