Home > database >  Sqlite3 column alias application problems
Sqlite3 column alias application problems

Time:09-28

Hello, everyone, I am to have such a demand, need to ask you,
I use in the SQL statement to a column alias, and in the SQL statement, I also need to use this nickname for mathematical operation to get a new column, can realize the sqlite excuse me? The column alias by from another find the unique value in the table definition, the following example:
Select A, B (select from t2) as C, Round as D (C - A) from t1
I want contains A, C, D three columns of data table,
(select from t2 B) is A single value, can be converted into C, this you need not discuss, I can't find in the use of the above statements suggest C column, and if there is no Round (C - A) as D, statements can pass, get two columns of data table, containing both A and C

CodePudding user response:

Nested query!

Select a, c, Round as D (c - a) from (
Select A, B (select from t2) as C from t1) ls
  • Related