Results 1 to 2 of 2

Thread: Grabbing the most recent record

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    23

    Talking

    I am having a problem with an asp page. I have a link that when you click it, it goes in my database and show the most recent record. Obviously there is date field, but i am not sure how you grab this record. Can anyone give me the correct sql code to achieve this result. I am ok on everything except the sql. I even have the database sorted by descending order by the date, so the most recent is on the top.


    thanks
    Stephen
    Stephen Warker

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    you have a couple choices:

    SQL like this:
    select * from orders where orderdate in (select max(orderdate) from orders)

    Or just open your recordset, sorted by date descending, and just display the first record

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width