Results 1 to 2 of 2

Thread: select data using numbers of days

  1. #1
    Join Date
    Jun 2003
    Posts
    3

    Unhappy select data using numbers of days

    I would like to know if I could delete data and leaving only just 2 days of records.

    Each time it will compare today's date and if the from_date is more than 2 days, it will delete the rows away, if today is 2003-06-05 00:00:00.000, then the first 3 records should be removed.

    The table got a date field

    from_date
    ---------------------------
    1990-06-01 00:00:00.000
    2003-06-02 00:00:00.000
    2003-06-03 00:00:00.000
    2003-06-04 00:00:00.000
    2003-06-05 00:00:00.000

    Am not able to select the records mark for deletion.

    C.E>

  2. #2
    Join Date
    Mar 2003
    Location
    NJ
    Posts
    201
    delete from pen where From_date < getdate()-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
  •