I have a shape named "Subdistrict" and it shown on Attribut Table like this :
No | subd | village
1 | town1 | v1
2 | town1 | v2
3 | town1 | v3
4 | town2 | v4
5 | town2 | v5
6 | town2 | v6
7 | town3 | v7
8 | town3 | v8
9 | town3 | v9

I want to select only town1 and town3, and only v1, v3, v7, v8
I've select define classes each class differentley and use SQL Querry to select only Village :v1,v3,v7,v8 to shown on label, but it's not working.
this is my SQL querry code :

subd= 'town1' AND 'town3' AND village='v1' AND 'v3' AND 'v7' AND 'v8'

Any solution for this?

  • 1
    This statement cannot produce a selection as no subd can be 'town1' and also 'town2'. Boolean logic is that it must be OR so: subd = 'town1' or subd = 'town2'. The use of brackets in this case is advisable. Commented Apr 23, 2014 at 3:18
  • Yes, it has to use brackets, Already Solved. Thanks Commented Apr 23, 2014 at 3:22
  • Please do not put "SOLVED" in your Question title - the way to indicate that you have a solution is to either click the Accept button next to the most helpful Answer you received, or if none led you near it then write (and Accept) your own Answer.
    – PolyGeo
    Commented Apr 23, 2014 at 8:59
  • okay, got it. edited Commented Apr 23, 2014 at 13:11

1 Answer 1


Your SQL query should be:

(subd = 'town1' or subd = 'town3') and village in ('v1','v3','v7','v8')

for only town1 with v1,v3..v8 and town3 with v1,v3..v8.


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.