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)
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Oct 27, 2016 at 19:30
2
  • Your SQL is not correct: Select * From [Table] Where Week <> Wk AND Wk <> '' 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. 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.

answered Oct 27, 2016 at 20:05
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.