Hello! I am trying to create an SQL query through the Select By Attribute window on a date field that will select the current date and everything two years prior. I can't seem to find anything online where this has been completed successfully. I am using ArcMap 10.7 and trying to do the Select By Attribute on a Date field which I manually enter the dates into. The reason I want an SQL expression that will grab the Current Date and everything prior for two years is because this expression will then be incorporated into a nightly run model so the date is consecutively changing as time goes on.
One thing that I think is important to mention is that I am not entering new dates into my database daily. With this being said then, can I use CURRENT_DATE in my expression?
For example: I wrote this post on 08/14/2019. So the expression I am looking for, when run today would select all dates between 08/14/2019 and 08/14/2017 and then tomorrow the expression would select all dates between 08/15/2019 and 08/15/2017.
Also my selection field is called: LegalEnd_Da
I have tried the following expression, which verifies successfully yet nothing in my attribute table is actually selected:
"LegalEndDa" <= (CURRENT_DATE -750) AND "LegalEndDa" >= CURRENT_DATE
Thank you in advance and I hope I have clarified my end goal clearly enough.
Siona
After writing this post and staring at my expression for sometime, I realized I had my Less Than/Greater Than symbols backwards. The expression worked like a charm, in case anyone is out there trying to do the same thing!