Reputation: 624
In CrateDB is there a way to avoid to re-select the same column in nested SELECT
statement, to show the value in the results?
e.i. in the following query, is there any way to avoid re-selecting A and B through the nested SELECT
? Ideally would be nice to select just once in the first
SELECT
A,
B,
AB,
A * B * AB AS ABAB,
A / AB::DECIMAL AS AAB,
FROM (
SELECT
A,
B,
(A + B) AS AB,
FROM (
SELECT
(SELECT count(*) FROM schema.table_01 WHERE process_state IN ('State_1')) AS A,
(SELECT count(*) FROM schema.table_01 WHERE process_state IN ('State_2')) AS B,
) alias_for_subquery_01
) alias_for_subquery_02
Thanks
Upvotes: 0
Views: 43