Q:

Error in Conditional Statement in QGIS Field Calculator

I have a layer with multiple columns as shown in the picture below. If I want to make another column giving 'match' when column 'layer' and 'left(dista' are same value. How can I apply this in field calculator using if(conditional) or something else?
I used following conditionals;
if('layer'='left(dista', 'match', 'unmatch')
but it's showing errors 
left function is called with wrong number of arguments. Expected 2 but got 1.
syntax error, unexpected COMMA, expecting $end
syntax error, unexpected COMMA, expecting $end
syntax error, unexpected ')', expecting $end

A:

Usually, you can choose between two ways to format a field name in the Field Calculator:

If the field name has no spaces, you can use only the field name, like this: fieldname
If the field name has spaces or resembles a field calculator function, you must enclose the name in doublequotes, like this: "field name"

Your field, "left(dista" looks like the Field Calculator function left(). It looks like the Field Calculator is attempting to run the left() function instead of retrieving the field value. 
That's actually not what I would expect from your function; since you put the field name in singlequotes, I would expect it to evaluate 'left(dista' as a string. It would find that the string 'layer' does not equal the string 'left(dista', so the result would always be 'unmatch'.
Try enclosing each field name in doublequotes, like this:
if("layer"="left(dista", 'match', 'unmatch')

If that doesn't work, it's probably because the Field Calculator gets confused by the parenthesis in the field name. In that case, re-name your fields so they don't have parentheses. Open the layer properties dialogue > source fields tab > Toggle editing mode on > re-type the field name.

