Keeping a DB clean

Results 1 to 2 of 2

Thread: Keeping a DB clean

  1. #1
    Join Date
    Dec 1969

    Default Keeping a DB clean

    I have a db of new employees that I'll be using to populate some intranet pages with their info. I only want at any given time to display the most current 8. Ten years from now I don't want a thousand entries in the table either. I would rather just keep the table at 8 entries, deleting as I go along. I think what might work is when adding a new employee to the db, also delete the oldest entry (they are ordered by their start date). How would I go about doing this? I thought what might work is to put the entries into an array in descending order and then just deleting the first item in the array. Any ideas? (some code may be helpfull too!!) Thanks.

  2. #2
    Join Date
    Dec 1969
    Indianapolis, IN

    Default RE: Keeping a DB clean

    Your DELETE statement would look like this:<BR><BR>DELETE FROM mytable WHERE startdate = (SELECT TOP 1 startdate FROM mytable ORDER BY startdate)

Posting Permissions

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