2

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?

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

1 Answer 1

1

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.

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

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.