我有两个字段包含和排除,我想在它们中提取唯一数据并将结果显示为一列结果。 例如,包含和排除具有相同的可能值,如午餐,晚餐,无线网络。结果应该是这样的, excludesAndIncludes (排除和包括的独特结果) ..................... 午餐 晚餐 无线上网 等
答案 0 :(得分:1)
您可以使用union
:
select excludes as excludesAndIncludes from t
union
select includes from t;
答案 1 :(得分:0)
你可以写这样的查询:
select DISTINCT x.excludesAndIncludes from
(select DISTINCT excludes as excludesAndIncludes from t
union
select DISTINCT includes as excludesAndIncludes from t) as x;