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:


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

  • 2
    Which GIS software and version are you using? For something like this, you may need to use the modulus operator: "id" %3 = 1 – Joseph Aug 11 '17 at 10:19
  • 1
    Please edit the question to specify the GIS software in use, the format of the base data, and it's a database table, the RDBMS in which that table resides. – Vince Aug 11 '17 at 11:34
  • You still haven't specified the format of the data source. – Vince Aug 13 '17 at 15:31

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:

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.