Can I use MOD in Query Builder?

5065
2
09-20-2017 02:21 PM
PaulHuffman
Occasional Contributor III

I thought I have done this before but I can't make it work in Definition Query> Query Builder.  If I just want to select features from a feature class for an item that evaluated to even 10s,  like  

MOD("MILE_NR" / 10) = 0

Can't I use MOD in my Definition Query?  Don't see MOD in the Query Builder Help, but I see it in the SQL reference docs.  Is it because the item MILE_NR is float, 0, not an integer? Didn't see INT in the Query Builder Help either, so I also tried

MOD(ROUND("MILE_NR",0) / 10) = 0

  Same message "invalid SQL statement was used"

Do I need the do this selection in Python? 

2 Replies
DanPatterson_Retired
MVP Emeritus

If you can use python (just using a variable now as an example)

MILE_NR % 10
0

but your field names and query would appear as ..   !MILE_NR! % 10 == 0

As an example using a variable

MILE_NR % 10 == 0

True

PaulHuffman
Occasional Contributor III

Thanks Dan.  But I was over thinking this.   The separator for MOD in this environment is a comma, so

MOD("MILE_NR", 10) = 0

  works just fine.  No need to convert MILE_NR to an integer even! I just need to read the docs more carefully!