5

I have an attribute table in which each record contains the name of a state as well as several other characteristics. I want to select all states that are named in a subset.

I tried this:

"NAME" IN (‘Florida', 'Kentucky', 'Tennessee', 'Georgia', 'North', 'Carolina', 'South', 'Carolina', 'Alabama', 'Mississippi', 'Louisiana', 'Texas’)

The return was this:

Expression is invalid. Parser Errors: syntax error, unexpected STRING, expecting COMMA or ')' syntax error, unexpected NAME, expecting end of file syntax error, unexpected STRING, expecting end of file syntax error, unexpected NAME, expecting end of file syntax error, unexpected STRING, expecting end of file syntax error, unexpected NAME, expecting end of file syntax error, unexpected STRING, expecting end of file syntax error, unexpected NAME, expecting end of file syntax error, unexpected STRING, expecting end of file syntax error, unexpected NAME, expecting end of file

I've messed around trying various things, like removing formatting & so on.

What do I have to change in order to get this to work?

1
  • 1
    These must be single strings, not separate words: e.g. 'North', 'Carolina' -> 'North Carolina' as well as you’re using “smart quotes” instead of straight quotes: e.g. 'Texas’ -> 'Texas' Commented 17 hours ago

1 Answer 1

8

You have the wrong quote character: ‘Florida' should be 'Florida', same with Texas.

So change:

"NAME" IN 
  (‘Florida', 'Kentucky', 'Tennessee', 'Georgia', 
   'North', 'Carolina', 'South', 'Carolina', 
   'Alabama', 'Mississippi', 'Louisiana', 'Texas’)

to:

"NAME" IN 
  ('Florida', 'Kentucky', 'Tennessee', 'Georgia', 
   'North', 'Carolina', 'South', 'Carolina', 
   'Alabama', 'Mississippi', 'Louisiana', 'Texas')

(If you are trying to select North Carolina you should enclose both words in one pair of quotes: 'North Carolina', or you will select all states with North in the name)

Your Answer

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.