PDA

View Full Version : Query puzzle...


iceflyin
11-11-2007, 07:24 AM
Edit: New question... Is it possible to delete all the data in a table with a value less than a number?


EG PSEDOCODE delete everything older than 20 days:

if(getdate(yday) >20){

$deleteOld = getdate(yday) -20;
mysql_query ("DELETE FROM inbox WHERE yday<=$deleteOld");
}

guelphdad
11-11-2007, 01:44 PM
look into the use of DATE_SUB. also note though that you'd have to have a date field to do this. mysql doesn't store when you add something to the database.