Skip to content
Advertisement

Replacing null based on a condition

I am having a table with many columns (but posting only col1, col2, col3 here for simplified post):

I want to fill null values of source _id with values from id. For example, source_id a5 row has null which has to replaced with id a1 values, subsequently, source_id a6 row having null to be replaced with a5 row

Output:

Advertisement

Answer

This looks like a left join and conditional logic:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement