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)
  • Your SQL is not correct: Select * From [Table] Where Week <> Wk AND Wk <> '' – Brad Oct 27 '16 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 Oct 27 '16 at 20:30
2

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

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.