I am using Query Builder in QGIS 2.14.2-Essen to select one country (Peru) among 237 for which to show two layers (states_provinces, boundary lines) from the Natural Earth database. I am paying close attention to corresponding attribute tables. However, a recurring error message is generated: "OGR[3]: SQL Expression Parsing Error; syntax error, unexpected end of string." The screenshot of the message is below. SQLerror_querybldr

I have been unsuccesful at resolving this issue, despite widely searching the web.

  • 1
    And what is the SQL expression? May 15, 2016 at 23:40
  • Referring to screenshot (now showing), it is "admin" = ´Peru´
    – alearcei
    May 16, 2016 at 17:34

1 Answer 1


Make sure you use the right type of single quotes: ''

If you use `` the parser will freak out.

  • I was double-clicking on the exact names among those listed in my desired field, so the single quotation marks appeared automatically. At any rate, now it is working BUT I have encountered another problem. I succesfully highlight one region. When I want to add a second region with AND, nothing happens (not even error message). The exact SQL is: "name" = 'Huancavelica' and "name" = 'Junín'
    – alearcei
    May 16, 2016 at 19:30
  • If it worked for you, please accept the answer. For your new problem, I think it could be related to the accent in Junín. If the problem persists, please ask a new question. May 23, 2016 at 8:39
  • Steven Bernard (QGIS Tutorials in YouTube) helped me resolve it by suggesting I use OR instead of AND.
    – alearcei
    May 24, 2016 at 17:52

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.