下面只是一个例子,一般用OR 条件肯定会搞定的。
SELECT a, b from tb1 where a > 100 UNION SELECT a, b from tb2 where a > 1000;
会报错 FAILED: SemanticException 1:62 Top level UNION is not supported currently; use a subquery for the UNION. Error encountered near token '""'
正确的做法是:把所有UNION ALL子句放到sub-query中,并且给table加别名,如下:
SELECT * FROM ( SELECT a, b from tb1 where a > 100 UNION SELECT a, b from tb2 where a > 1000 ) tmp;