将多列合并为一个新列,同时保留原始列
Combining multiple columns into one new column, while keeping the original column
我有下面的 table,我试图将黄色的列合并到一列中,同时保持原来的列;突出显示的黄色列中的数据是根据它们所属的交互类型填充的,如果交互类型为空,这意味着它不属于交互类型类别:
对于我如何处理这个问题的任何帮助或指导,我将不胜感激
预期结果:
这看起来像 coalesce()
:
select t.*,
coalesce(
svc_proc,
interest,
transtypekey,
connectivity_name,
vm_entreprise_program,
channels
) as interaction_details
from mytable t
coalesce()
returns 参数列表的第一个非 null
值。
我有下面的 table,我试图将黄色的列合并到一列中,同时保持原来的列;突出显示的黄色列中的数据是根据它们所属的交互类型填充的,如果交互类型为空,这意味着它不属于交互类型类别:
对于我如何处理这个问题的任何帮助或指导,我将不胜感激
预期结果:
这看起来像 coalesce()
:
select t.*,
coalesce(
svc_proc,
interest,
transtypekey,
connectivity_name,
vm_entreprise_program,
channels
) as interaction_details
from mytable t
coalesce()
returns 参数列表的第一个非 null
值。