Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在 sqlite3 中做这样的事情,其中“...somelongexpression...”是我实际表达式逻辑的占位符:
SELECT ...somelongexpression... AS subexpr, subexpr * 2 AS twicesubexpr FROM sometable;
但是,我收到“错误:没有这样的列:subexpr”。
我不能在另一个中引用一个命名列表达式吗?
这在这种形式的 SQL 中是不可能的。
您将不得不使用子查询:
SELECT subexpr, subexpr * 2 AS twicesubexpr FROM (SELECT ...somelongexpression ... AS subexpr FROM sometable);