1

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?

3
  • 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
    Commented Aug 11, 2017 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
    Commented Aug 11, 2017 at 11:34
  • You still haven't specified the format of the data source.
    – Vince
    Commented Aug 13, 2017 at 15:31

1 Answer 1

5

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:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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