I have an SQLite3 query that blows up because a column does not exist. Here is a simplified version of the query:
SELECT
colA,
colB,
(colA + colB) colC,
(colA + colB + colC) colD
FROM
myTable
The query is exploding when colC is referenced on the line to compute colD. I was hoping that since I defined colC before colD, it would work.
What can I do to achieve what I’m wanting? I need colC to be computed at the time the query is ran.
Per this:
I would suggest trying this:
It’s possible that the computed value does not get aliased until the resultset is ready to go… or some other such timing issue. Why not simply repeat the calculation like this:
This way you avoid having to read the aliased, computed column.