select the record with the most recent order date

  • itortu (6/16/2014)


    this is my script, create and insert.

    i want to point out that if i run this script:

    select * from [dbo].[salesquotestest] WHERE prioriquotedate IN (SELECT MAX(prioriquotedate) FROM [dbo].[salesquotestest] )

    i get the item with the latest date, but i need to get each of the items not just the one item with the most recent date

    thank you very much

    itortu (6/16/2014)


    ...I need to only get the records with the most recent delivery date, in this example that would be 04/29/2014...

    An accurate description of your requirements will yield an accurate solution.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

Viewing post 16 (of 15 total)

You must be logged in to reply to this topic. Login to reply