4

I am using QGIS.

I have an attributetable with several columns.

I want to change the values of column1 if they are NULL with the values of the same row in column5.

case WHEN column1 is NULL THEN 
END

How do I say "use the value from the same row"?

3 Answers 3

13

The field calculator always calculates on a row-by-row basis. So you can use:

CASE WHEN "column_1" IS NULL THEN "column_5"
ELSE "column_1"
END
0
9

You can also use coalesce to replace NULL values from column_1 by column_5.

coalesce("column_1", "column_5")
2

Open the attribute table and make it editable.

  1. Select by expression "column_1" isnull

  2. Along the top of the attribute table you an select in a drop down a column of your choice. Select "column_1"

  3. In the text box available write "column_5"

  4. Click "Update Selected"

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.