I am using QGIS version 2.14.1 (Essen) and trying to update data in my table using field calculator.

I am inputing the following statement:

update "table_1" 
set  "table_1" ='y' 
where  "table_2" ='test'

But I get the following error message:

syntax error, unexpected COLUMN_REF, expecting $end

Anyone know where i'm going wrong?

  • Are "table_1" and "table_2" from the same attribute table (same layer)? – Joseph Apr 27 '16 at 10:26
  • @Joseph yes they are from the same layer... – philippe Apr 27 '16 at 10:27

If you select "table_1" for the Update existing field option, try using this expression:

if( "table_2" = 'test', 'y', "table_1")

Basically, you're using an IF THEN ELSE statement.

  • 1
    Perfect that works! – philippe Apr 27 '16 at 10:38
  • @philippe - Awesome, glad it works :) – Joseph Apr 27 '16 at 10:42

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.