On Sat, Jun 9, 2018 at 7:00 PM, Andy Goth <andrew.m.g...@gmail.com> wrote:
> On 06/09/18 18:04, Simon Slavin wrote:
>> CREATE TABLE tempLog (
>> datestamp TEXT COLLATE NOCASE PRIMARY KEY,
>> centTemp REAL,
>> fahrTemp AS (centTemp*9/5 + 32) )
>> I'm happy with another syntax as long as it does the same thing.
> CREATE TABLE tempLog (
> datestamp TEXT COLLATE NOCASE PRIMARY KEY
> , centTemp REAL);
> CREATE VIEW tempLogView AS
> SELECT *
> , centTemp * 9 / 5 + 32 AS fahrTemp
> FROM tempLog;
>> Niggle 1: Can a computed column refer to a column defined after it ?
> With the view syntax I showed above, "computed" columns can only refer
> to columns that exist in the underlying tables. I wish SELECT statement
> expressions could refer not only to input columns but also output
> columns that have been named using AS, but we don't have this feature.
SELECT *, (computation on Y) AS X FROM (
SELECT *, (some computation) AS Y FROM sometable)
It is a little annoying having to nest them, but it works.
sqlite-users mailing list