crate版本:1.1.3
我无法在CREATE中找到联合所有语法来执行复杂查询,我也搜索文档,但什么都没有
(SELECT col1,col2,col3 来自tab1) UNION ALL (SELECT col1,col2,col3 来自tab2)
如何在包中执行此sql
答案 0 :(得分:1)
您可以将UNION ALL与CrateDB 2.3.x一起使用,可在此处获取:https://crate.io/download/#stable
您可以运行以下查询:
SELECT id1, name1 from t1
UNION ALL
SELECT id2, name2 from t2
ORDER BY name1;
或者在任何一方使用子选择:
SELECT * from (SELECT id1, name1 from t1 order by id1 limit 2)
UNION ALL
SELECT id2, name2 from t2;
或加入多个表:
SELECT id1, name1 from t1
UNION ALL
SELECT id2, name2 from t2
UNION ALL
SELECT id3, name3 from t3
ORDER BY name1;
https://crate.io/docs/crate/reference/en/2.3/general/dql/union.html