合并多个查询结果

最近更新时间: 2024-06-12 15:06:00

  • 不过滤重复的记录。

     postgres=# select * from tbase union all select * from t_appoint_col;
      id |          nickname           
     ----+-----------------------------
       1 | hello TDSQL PG
       2 | TDSQL PG好
       1 | TDSQL PG分布式数据库的时代来了
       1 | hello TDSQL PG
     (4 rows)
  • 过滤重复的记录。

     postgres=# select * from tbase union select * from t_appoint_col;    
      id |          nickname           
     ----+-----------------------------
       1 | TDSQL PG分布式数据库的时代来了
       1 | hello TDSQL PG
       2 | TDSQL PG好
     (3 rows)