Select to view content in your preferred language

Select By Attributes Max Date

268
2
02-25-2025 05:18 PM
Labels (3)
AKRRMapGuy
Frequent Contributor

I am trying to select a point from an existing selection using Select Max on a date field. I have attached a screen shot, I can't figure out what I am doing wrong with the syntax.

Thank you in advance for your help!

0 Kudos
2 Replies
JoshuaBixby
MVP Esteemed Contributor

In general, don't upload a screenshot when you can write out the SQL and error code in text.  No matter how busy you are, the people volunteering to read questions and provide replies are just as busy or more.

There are at least a couple issues with the syntax being used.  Firstly, the Select by Attributes tool expects a SQL WHERE clause, so your current syntax results in a complete SQL statement of:

 

SELECT * FROM SDE.PassengerStartAndStops WHERE SELECT MAX(sys_timestamp) FROM SDE.PassengerStartAndStops

 

The statement is invalid, as Pro is already informing you.

The second issue I can't say exactly because I am confused what you are trying to do.  sys_timestamp is a DBMS function and not a field in the table. 

Maybe take a step back and share what exactly you are trying to do, not in code but in words.

0 Kudos
AKRRMapGuy
Frequent Contributor

I am trying to select a max date, and a min date from a selection of points with a timestamp in the last day. The Sys_timestamp is a date being populated with an Arcade insert rule with the Now() function. 

The points being represented are exit and enter events from Geoevent Server. I need to combine them into one record, probably using Model Builder, so that I can do time elapsed, distance traveled and average speed analysis on the fly or nightly. 

0 Kudos