[GIS] Why isn’t the select by attributes query working

arcgis-10.1arcgis-desktoperrorquerysql

I'm running ArcMap 10.1.

I have a point feature class joined to a table and am trying to query a field.

If I do [field] = 'TEST', it selects all the fields.

But if I do [field] LIKE 'TES%', it doesn't work.

Any idea why the LIKE command isn't working?

Best Answer

The wildcard to use with LIKE depends on the data source.

You are using square brackets as field name delimiters. So I suppose you are using a Personal Geodatabase.

The wildcards you have to use to query a personal geodatabases are asterisk (*) for any number of characters and question mark (?) for one character.

If you use SDE or file based geodatabase you have to use percent symbol (%) and underscore (_).

Related Question