select max(DELIVERY_TIMESTAMP) from DOCUMENTS; will return the time that the latest document was delivered. How do I return the other columns for the latest document? For example I want DOC_NAME for the document that was most recently delivered?
I’m not sure how to form the WHERE clause.
You have a few options
Or with joins
It gets more complicated if there are duplicates in a timestamp or you need multiple columns in your ‘max’ criteria (because
MAX()is only over the one column for all rows)This is where the
JOINoption is the only option available, because a construction like this is not available (say multiple orders with identical timestamp):Where you in fact, would need to do: