合并表以从所有表中获取一组唯一记录的正确方法是什么?
What is the proper way to union tables to get set of unique records from all tables?
我有以下例子:
而且我不知道如何在这些表之间进行适当的联合
是列不同的问题吗?如果是这样,只需用空值填充它们:
select a, b, c, null as d from t1 union all
select a, b, c, null as d from t2 union all
select a, b, c, null as d from t3 union all
select a, b, c, null as d from t4 union all
select a, null as b, null as c, d from t5 union all
select a, null as b, null as c, d from t6 union all
select a, null as b, null as c, d from t7
我有以下例子:
而且我不知道如何在这些表之间进行适当的联合
是列不同的问题吗?如果是这样,只需用空值填充它们:
select a, b, c, null as d from t1 union all
select a, b, c, null as d from t2 union all
select a, b, c, null as d from t3 union all
select a, b, c, null as d from t4 union all
select a, null as b, null as c, d from t5 union all
select a, null as b, null as c, d from t6 union all
select a, null as b, null as c, d from t7