Just started using QGIS and a bit stuck on SQL or filter if anyone can assist please.

Table is labelled “SL” with multiple data columns. “ID” is the column of interest containing 10’s of thousands of location ID’s in the format of LOC00002345, LOC00002346 ..... and so on.

I need to set up an SQL or filter in QGIS that will return only the listed LOC ID’s. The list can vary in size and in the LOC ID’s needed.

Used to use the following in MapInfo but doesn’t work in QGIS.

ID = any("LOC00001234","LOC00001235","LOC00001236”,”LOC00001238”,”LOC00001250”)
  • ” != ", but anyways, in this case you should use '.
    – pLumo
    Jun 13 '18 at 6:17

If you want to match certain elements, you can use the following expression in the Query Builder:

ID IN ('LOC00001234','LOC00001235','LOC00001236')

Or, if you want all of them which start with LOC, then use:

  • Thx... much appreciated
    – Dale
    Jun 13 '18 at 0:44
  • ID = ANY('LOC00001234','LOC00001235','LOC00001236') would work, too.
    – pLumo
    Jun 13 '18 at 6:20

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.