0

Using ArcGIS Desktop 10.6.1. I'm interested in selecting multiple date ranges using Select By Attribute.

I've verified that each date range works. For example Date >= '2015-04-15' AND Date <= '2016-04-15' works great.

But I would like to also select that same date range for 2016-2017. I get an error if I continue with AND for the next range.

  • Dates are a special case, different feature storage types (shapefile, personal geodatabase, file geodatabase etc) have their own implementation of date types, can you post a screen shot of your select by attributes dialog and indicate what feature storage type you are selecting from please. – Michael Stimson Jun 25 at 5:10
  • I'm using a file geodatabase. I do not have access to Arc at the moment, so I can't provide a screenshot. – Susan Jun 25 at 5:12
  • Have a read of desktop.arcgis.com/en/arcmap/10.3/map/working-with-layers/… and community.esri.com/thread/105862 from the sounds of it you want to select (datefield >= '2015-04-15' AND Date <= '2016-04-15' ) OR (datefield >= '2015-04-15' AND Date <= '2016-04-15' ) - change the values to suit; your error is probably selection returns no records because you're excluding with an AND statement. – Michael Stimson Jun 25 at 5:19
  • I just gave that a try but it returned a selection of random values. Any thoughts? Here's what I used - ( Date >= date '2015-04-16 00:00:00' AND Date <= date '2016-04-15 00:00:00' ) OR ( Date >= date '2017-04-16 00:00:00' AND Date <= date '2018-04-15 00:00:00' ) OR ( Date <= date '2018-04-16 00:00:00' AND Date <= date '2019-04-15 00:00:00' ) – Susan Jun 25 at 6:20
1

Michael's earlier comment did indeed work - (datefield >= '2015-04-15' AND Date <= '2016-04-15' ) OR (datefield >= '2015-04-15' AND Date <= '2016-04-15' ). I just had to restart ArcMap.

0

Use the keyword BETWEEN to check for date range like this

DATE BETWEEN date '2019-04-08 00:00:00' and date '2019-04-17 00:00:00' OR DATE BETWEEN date '2018-04-08 00:00:00' and date '2018-04-17 00:00:00'
  • I don't have that syntax within the options for Select By Attributes. Even when I type it in, it gives me an error. – Susan Jun 25 at 15:40
  • Did you try and copy and paste into select by attribute and change field name? I copy and paste into my dataset just now and it worked ok. – Gary Lester Jun 26 at 16:11
  • It worked after I restarted ArcMap. Thank you! – Susan Jul 10 at 14:45
  • No problem, anytime. – Gary Lester Jul 12 at 9:21

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.