[GIS] Select by attribute using modulo operation

arcgis-desktoparcmapselect-by-attributesqlwhere-clause

In ArcMap 10.5, I want to select the rows where the modulus of the objectid by 3 equals 1.

How to write a SQL sentence in select by attribute window?

My current query statement is something like this:

MOD( [OBJECTID],3)=1

but unfortunately it selects all of the rows. What's the problem with that?

Best Answer

The following query works:

MOD("column_name", 3) = 1

where column values are of type integer belonging to a shapefile TOC.

Take a look at these related questions:

If you are querying a table from SQL Server using ArcGIS, then, the mod expression won't work. Use the modulo operator (%), instead. See: