NYGeog

Geography, GIS, Geospatial, NYC, etc.

Thursday, April 22, 2010

SQL Statement for Selecting Characters, sequential meaning coded value

So I received a spreadsheet where the number of asterisks meant the rating of a particular record. It wasn't hard to figure out this SQL statement but I thought it would be valuable to post as remembering something like this may come in handy one day. So I'll include an example using asterisks but this could be used for any type of situation where you need to include a single character but omit when that character comes up twice in sequence.

"Field_Name" LIKE '%*%' AND "Field_Name' NOT LIKE '%**%'

* = the ASCII character we are looking at

Selecting Features by a character without selecting the sequential iterations of it. Maybe a good application would be for like selecting singe 'L's in Spanish language databases w/out selecting the doube 'LL's.