1

I have an attribut table with 2 columns like this :
Column A Column B
22 NULL
23 NULL
24 NULL
25 NULL
26 NULL
NULL 52
NULL 53
NULL 54
NULL 55

I want to take the numbers of B (52 to 55) and replace the NULLs of the column A with these numbers like this :
COLUMN A
22
23
24
25
26
52
53
54

Aggregate or concatenate or & or + doesn't work in the field calculator because there are NULL in the process.

2 Answers 2

2

Create a new field with an expression:

coalesce( "Column A" , "Column B" )

Then rename the field to COLUMN A.

1
  • i just did that but the result is a copy of column B
    – Marc Robin
    Commented May 9, 2018 at 12:17
2

Use this expression to update COLUMN A for all features:

IF( "COLUMN A" IS NOT NULL, "COLUMN A" , "COLUMN B" )

enter image description here

Result: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.