How get earliest timestamp?

  • Thread starter Thread starter mscertified
  • Start date Start date
M

mscertified

I have a table with a date/time column.
I need to retrieve the earliest timestamp record.
I'm currently using SELECT MIN(timestamp), is this correct?

Thanks.
 
Yes.
But, are you filtering the query so it returns only one record?
If not, then you would need SELECT TOP 1 MIN(timestamp)
But then, I am thinking if you want to return only one value, why not use a
DMin function instead?
 
Good point. I had ignored the possibility of duplicate timestamps, but I
suppose it could happen!
 
Not an issue. If your query is ONLY referencing aggregate functions, then
only a single row will be returned. Even if there are duplicate data values,
there's still only a single value for the min().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top