How to find your lucky number in ArcMap?

How to find your lucky number in ArcMap

-Character matching of numbers

People always have some obsessions in life. Some people are obsessed with constellations, using twelve constellations to divide the crowd into twelve; some have obsessions with color, and even melancholy is blue; some people have obsessions with language and especially like Others call him "little cute" and "little clever ghost". Similarly, there are still many people who are obsessed with numbers. According to the statistics of Roadside News, 90% of people feel that their lucky numbers are among 3, 7, and 9.
Insert picture description here
As we all know, the fields in ArcMap are divided into many types, mainly including integer, floating point, double floating point, date type, string type, etc.

Sometimes, we will have the need for character matching of numbers. For example, we downloaded the county-level administrative boundary map of the Beijing-Tianjin-Hebei region, as shown in the figure below:
County-level administrative division map of the Beijing-Tianjin-Hebei region
one of the fields is called ID_3, as shown in the figure below:
Long field
mark ID_3 in On the map, the effect is like this:
Insert picture description here
These numbers are all long integers. What if we want to filter out the numbers that contain "5"?

If you write ID_3 like'%5%' directly, an error will be reported when the statement is executed, as shown in the following figure:
Insert picture description here

The solution is simple, that is, first convert the number to a string, and then perform character matching.

The complete SQL statement is as follows:

CAST(ID_3 AS CHARACTER) like '%5%'

If you execute this statement, you will find that you are done: It
Filter results
should be noted that if it is a layer in gdb, an error will be reported when executing this statement, but don't be nervous, just adjust it slightly.

CAST( OBJECTID_1 as char(10)) like '%6%'

Guess you like

Origin blog.csdn.net/esa72ya/article/details/97623193