合并多个查询结果 本文为你介绍合并多个查询结果的方法。 不过滤重复的记录。 plaintext teledb create table teledbpg1(id int, nickname varchar); CREATE TABLE teledb insert into teledbpg1 values(3, 'pg'),(5,'test'); COPY 2 teledb select from teledbpg union all select from teledbpg1; id nickname + 1 teledb 1 hello,pgxc 2 TELEDB 3 pg 4 5 test 3 pg (7 rows) 过滤重复的记录。 plaintext teledb select from teledbpg union select from teledbpg1; id nickname + 1 teledb 1 hello,pgxc 4 5 test 2 TELEDB 3 pg (6 rows) 每个子查询分布在合并结果中的使用。 plaintext teledb select from (select from teledbpg limit 2) as t union all select from (select from teledbpg1 limit 2) teledb ; id nickname + 1 teledb 1 hello,pgxc 5 test 3 pg (4 rows)