diff --git a/docs/querying/sql.md b/docs/querying/sql.md index 861397265bf..a46b4b1243f 100644 --- a/docs/querying/sql.md +++ b/docs/querying/sql.md @@ -167,9 +167,9 @@ together and appear one after the other. #### Table-level -UNION ALL can be used to query multiple tables at the same time. In this case, it must appear in the FROM clause, -and the subqueries that are inputs to the UNION ALL operator must be simple table SELECTs (no expressions, column -aliasing, etc). The query will run natively using a [union datasource](datasource.md#union). +UNION ALL can be used to query multiple tables at the same time. In this case, it must appear in a subquery in the +FROM clause, and the lower-level subqueries that are inputs to the UNION ALL operator must be simple table SELECTs +(no expressions, column aliasing, etc). The query will run natively using a [union datasource](datasource.md#union). The same columns must be selected from each table in the same order, and those columns must either have the same types, or types that can be implicitly cast to each other (such as different numeric types). For this reason, it is generally @@ -190,7 +190,7 @@ GROUP BY col1 When UNION ALL occurs at the table level, the rows from the unioned tables are not guaranteed to be processed in any particular order. They may be processed in an interleaved fashion. If you need a particular result ordering, -use [ORDER BY](#order-by). +use [ORDER BY](#order-by) on the outer query. ### EXPLAIN PLAN