HOW TO

Build a SQL query based on a date field to select all records where the date is within the next 30 days

Last Published: April 25, 2020

Summary

Instructions provided describe how to build a SQL query for use in the ArcMap Select By Attributes dialog box to select all records in a date field within the next 30 days.

Procedure


Note:
Data must reside in a personal geodatabase for the syntax of this query to work, as it is based on Microsoft Access SQL query syntax.


Enter the following query:
[FIELD_NAME] between Date () and DateAdd ( "d", 30, Date())

FIELD_NAME, in the above example, is the name of the date field.

This selects all records in the designated field that are between the current date and the current date with 30 added to the day.

    Article ID:000009930

    Software:
    • ArcMap

    Receive notifications and find solutions for new or common issues

    Get summarized answers and video solutions from our new AI chatbot.

    Download the Esri Support App

    Discover more on this topic

    Get help from ArcGIS experts

    Contact technical support

    Download the Esri Support App

    Go to download options