Re: Date comparison in SQL
Posted in 1994
From Joe Matuscak:
*
* Hi. Ive got a table that is used for logging information about when a
* program is run. Among other things, its got a date field in it. Id like to
* have my nightly cron job run some SQL that basically says "delete from
* userlog where timestamp is older than 6 months". Can someone shed some
* light on how to do that?
Create a script called whatever you want it to be and put in it:
isql db_name >/tmp/delete.log <<!
delete from userlog where timestamp < ( TODAY - 180 );!
Robert Minter |Data Systems Support| \\\\\\_///
Programmer, Software Development | Orange, CA | ( _ _ )
internet: rob@dssmktg.com | Tel: 714.771.0454 | (| ^ |)
bangpath: uunet.uu.net!dssmktg!rob| Fax: 714.771.3028 | \\`-'/
#include <disclaimer.h> \\_/