Reputation: 99
I found this weird in SQLite, if I simply select a column based on previously selected columns. The following SQL statement:
SELECT Column1 AS C1, C1 || 'something' AS C2 FROM Table1;
Will return an error in SQLite:
No such column C1
But it goes on without an error in Access.
Wondering how do I do a similar selection in SQLite? Basically I want to do this in a single SELECT
instead of two SELECT
.
Upvotes: 0
Views: 870
Reputation: 1269623
The canonical way is:
Select C1, C1 || 'something' AS C2
from (select column1 as c1, t1.*
from Table1 t1
) t1
Upvotes: 1