Results 1 to 4 of 4

Thread: Calling last 5 records from database????

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Location
    Ireland
    Posts
    8

    Question Calling last 5 records from database????

    Morning
    Could anyone give me any code that would enable me to call the last 5 records from an sql database?

  2. #2
    Behemoth
    Guest
    how big is the database?

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Location
    Ireland
    Posts
    8
    around 200 records holding articles......

  4. #4
    Frenzied Member seoptimizer2001's Avatar
    Join Date
    Apr 2001
    Location
    Toledo, Ohio USA GMT -5
    Posts
    1,075
    You can still use the top function because you say you want the last 5 records. Last is just relative to if the recordset is sorted ascending or descending. So do this:
    Code:
    Select top 5 yourfieldname from yourtable where ... order by yourfieldname asc(or desc)

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