1

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")
PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jun 12, 2018 at 18:17
1
  • " != ", but anyways, in this case you should use '. Commented Jun 13, 2018 at 6:17

1 Answer 1

3

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:

ID LIKE 'LOC%'
answered Jun 12, 2018 at 18:23
2
  • Thx... much appreciated Commented Jun 13, 2018 at 0:44
  • ID = ANY('LOC00001234','LOC00001235','LOC00001236') would work, too. Commented Jun 13, 2018 at 6:20

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.