Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have been trying by best to create a definition query which would select a group of municipalities from among the many in my state. I have tried commands of all sorts of variations from "Name"='Chatham'AND 'Chester' AND 'Far Hills'..... to "Name"=('Chatham', 'Chester', 'Far Hills... and so on but I keep getting an error when I try to validate.

share|improve this question
4  
w3schools.com/sql/sql_in.asp –  whuber Jun 13 '11 at 20:51

3 Answers 3

Building a query expression. Check the Combining Expressions sub-heading to see how to use the AND/OR operators correctly.

For your example you should implement "IN":

"Name" IN ('Chatham','Chester')

share|improve this answer

I would think OR rather than AND

share|improve this answer
2  
@Katie, in your example, you also left out the fieldname in front of each query attribute. If you wanted to use this mething, you would need to include the fieldname in front of each query attribute: "Name"='Chatham' OR "Name"='Chester' OR "Name"='Far Hills'. This is slow and tedious, so using the "IN" operator is much more efficient. –  RyanDalton Jun 13 '11 at 23:30

Use "Name" IN ('Chatham','Chester Falls'...) Separate each with a comma and end with a closed parenthesis.

share|improve this answer
    
Thank you! I didn't realize IN was a command I could use –  Katie Jun 14 '11 at 16:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.