合并多个查询结果

最近更新时间: 2025-02-18 16:02: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)