
January 14th, 2000, 03:38 PM
|
|
Contributing User
|
|
Join Date: Oct 1999
Location: Annapolis, Maryland US
Posts: 113
Time spent in forums: < 1 sec
Reputation Power: 14
|
|
|
Another example: say you have a two column table with an event name (event) and the date of that event in timestamp(8) format (event_date) and you wish to delete the events from the database that are more than 7 days old.
delete from table_name where to_days(now()) - to_days(event_date) > 7;
or
select event from table_name where to_days(now()) - to_days(event_date) = 7; // select last week's events
the to_days() function works on date and timestamp data types and returns the number of days since year 0 -> 1 A.D., 1 B.C. or somewhere around there
[This message has been edited by Kyuzo (edited January 14, 2000).]
|