1

I've tried several iterations of this SQL statement in a stand alone script:

    QF5 = "Week"
    QF6 = "Wk"
    RV3 = ""
    WC4 = """" {} <> {} AND {} <> '{}' """.format(QF5,QF6,QF6, RV3)

I'm aiming for an expression that would read int he field calculator:

Select From(*) Table Where:
Week <> Wk AND Wk <> ''

This is the error I'm getting:

ERROR 000358: Invalid expression
Failed to execute (SelectLayerByAttribute)
2
  • Your SQL is not correct: Select * From [Table] Where Week <> Wk AND Wk <> ''
    – Brad
    Commented Oct 27, 2016 at 19:47
  • Right, sorry I was just guessing the first part of the query from the field calculator. That bit is not being expressed int the script.
    – geoJshaun
    Commented Oct 27, 2016 at 20:30

1 Answer 1

2

This should work: WC4 = """{0} <> {1} AND {1} <> ''""".format(QF5,QF6) Your double quotes were unbalanced, and you don't need RV3.

0

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.