Amazon redshift 选择不同的多个列,其中一个结果列为红移
我想执行以下红移。可以使用unnest在Postgrsql中处理它,但不能使用红移 实际上我有像这样的排Amazon redshift 选择不同的多个列,其中一个结果列为红移,amazon-redshift,Amazon Redshift,我想执行以下红移。可以使用unnest在Postgrsql中处理它,但不能使用红移 实际上我有像这样的排 id col_a col_b col_c 1 ABD CDE XYZ 2 CDE null null 3 ABD null null 3 FGH LMN null 我期望结果是 ABC ABD CDE FGH LMN XYZ 使用UNION为每列获取不同的值: select col_a as col from tablena
id col_a col_b col_c
1 ABD CDE XYZ
2 CDE null null
3 ABD null null
3 FGH LMN null
我期望结果是
ABC
ABD
CDE
FGH
LMN
XYZ
使用
UNION
为每列获取不同的值:
select col_a as col from tablename
where col_a is not null
union
select col_b from tablename
where col_b is not null
union
select col_c from tablename
where col_c is not null
order by col
@Blanko请不要用
postgresql
标记专门用于红移的问题。虽然它们有一些古老的根源,但这两种产品有着很大的不同。感谢福帕,我正在寻找有效的解决方案,而不是联合。还有其他方法吗?除非Redshift有任何特殊的方法(我不知道),否则你必须使用UNION。