I would like to write an SQL statement that ...

I would like to write an SQL statement that returns a list that will return the record which's creation time is the latest out of a few that answer the same criteria.

How do I do that?


Share Send to a friend Watch Report
 
 

3 Posted Answers
Order by

 
15 helpful answers

I don't exactly understand your question, so it's either:

select max(creationTime) from whatever where criteria = 1

or:

select * from whatever where criteria = 1 order by creationTime desc

Posted 2007-02-14T10:33:13Z
 
10 helpful answers

The 1st one. How do I ask a record what's its creation time?

Posted 2007-02-16T04:44:12Z
 

you have to add the creation date as a column to the table...

 

and then you can run:

select top 1 * from tableName where (criteria=1) order by dateCreated desc 

Posted 2007-11-12T11:22:09Z

Sign in to participate

Got an answer for scf84? Would you like to comment on the posted answers, or vote for the one which you think is the best?

Sign up for a free account, or sign in (if you're already a member).

Explore Related Questions

Other people asked questions on similar topics, check out the answers they received:


Q:

Asynchronous jobs in sql server

Is there a way to run asynchronous jobs in sql server? I'm looking for an equivalent to Oracle's dbms_job.
Submitted by beytz   2 years ago.
  • viewed 490 times


Q:

How do I protect my self from sql injuction ...

How do I protect my self and my site from sql injuction?
Submitted by del2   3 years ago.
  • viewed 1055 times
Last answer posted 3 years ago by leonid


Q:

How do I write a select query in SQL Server 2005 ...

How do I write a select query in SQL Server 2005 that calculates a value with the previous record value? I have a select that ...
Submitted by dudushmaya   3 years ago.
  • viewed 1302 times
Last answer posted 3 years ago by gliksman



» More...

Feed - Subscribe to changes to this Q&A Blog
ADVERTISEMENT
ADVERTISEMENT
AOL Autos Q&A is powered by Yedda an AOL Company
Copyright © 2006-2009, Yedda Inc. and respective copyright owners