I have two columns of the same data and I want to unite

for example I have the column "pole_type" and "pole_type_" and sometimes one has values and some times the other

like seen in the photo

enter image description here

I want to get all the values in "pole_type_" into "pole_type" so I can delete the first

Iv'e used so far the following rules but not succeeded




and so on but I havn't came up with anything that works.

  • 1
    Assuming empty are blank, not NULL (your second example), try adding a second = and remove the space : IF("pole_type"=="","pole_type_","pole_type") – smiller Oct 24 '18 at 16:27
  • Are you able to perform a selection of your data (outside of the calculator) for either blank or NULL? An example of selecting for NULL is here: gis.stackexchange.com/questions/16134 – smiller Oct 24 '18 at 16:30
  • 2
    In the screenshots your column is called "/_pole_type" (with an underscore at the start) but your formulas use "pole_type_" (with an underscore at the end). – csk Oct 24 '18 at 16:50

Welcome to the wonders of COALESCE. Try this:

COALESCE( "pole_type_" , "pole_type" )

It will return the first non-null value in a list. If they are all null, it will return null.


You can use:

CASE WHEN "pole_type" IS NULL THEN "pole_type_" ELSE "pole_type" END


Another way, less efective, but easy for new users like me, could be:

Select by expression "pole_type" is NULL

enter image description here

Then make your table editable and update field "pole_type" with "pole_type_", but only selected features.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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