Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have below table, where I am trying to merge the columns in yellow in one column, while maintaining the original columns; the data in the highlighted yellow columns is populated based on the interaction type they fall into if the interaction type is null that means it doesn't fall into the interaction type category:

Would appreciate any help or guidance on how I can approach this

enter image description here

Expected outcome: enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
237 views
Welcome To Ask or Share your Answers For Others

1 Answer

This looks like coalesce():

select t.*,
    coalesce(
        svc_proc, 
        interest, 
        transtypekey, 
        connectivity_name, 
        vm_entreprise_program,
        channels
    ) as interaction_details
from mytable t

coalesce() returns the first non-null value of the arguments list.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...