getting the last record in a database

Results 1 to 2 of 2

Thread: getting the last record in a database

  1. #1
    Tobias Brandvik Guest

    Default getting the last record in a database

    I have a database with a lot of articles.. On my main page I want to list the four latest articles, which would equal the 4 last records in the database. How do I get these records. I could get all the records, move the cursor to the last and write them, but that does not seem very efficient. <BR><BR>There *must* a way to only get the four last records in the database...<BR><BR>Thanks in advance for any help..:)

  2. #2
    Join Date
    Dec 1969

    Default try this

    SELECT TOP 2 * FROM SALES ORDER BY STOR_ID DESC<BR><BR>used pubs to test it...what you do is select the top 2 recorders form the database but reverse the this selects the bottom 2.

Posting Permissions

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