Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2007
    Posts
    91

    Unanswered: Displaying the 5 last records used

    Is there a way i can display the 5 last storenames i've saved?

    Like the myrecent document in ms office
    Pls kindly help

    Regards
    Noks

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    How would you identify the last 5 storenames - do you have a timestamp next to each record?

    You may wish to read this thread in the mySQL thread - the OP has asked a similar question to you (how do I select the top x...).

    Also take a look in the helpfiles (or on google) for the TOP keyword in SQL.

    HTH
    George
    Home | Blog

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by georgev
    You may wish to read this thread in the mySQL thread - the OP has asked a similar question to you (how do I select the top x...).
    SQL Server forum

    Also - there are a few silly posts in that thread. Ignore any that include "newid()".
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Mar 2007
    Posts
    91
    thanks guys...yep, hav a time stamp (date & time)

    Noks

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    This is similar to what you need.
    Code:
    SELECT TOP 5 Storenames
    FROM Stores
    ORDER BY TimeStamp DESC
    George
    Home | Blog

  6. #6
    Join Date
    Mar 2007
    Posts
    91
    Worked like a charm thanks

    my code:
    SELECT TOP 5 Sasol_Campaign_history.[Store Name] FROM Sasol_Campaign_history ORDER BY Sasol_Campaign_history.txtDate DESC , Sasol_Campaign_history.[Store Name];

    Thank you
    Noks

Posting Permissions

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