guyfromfl Posted August 4, 2007 Share Posted August 4, 2007 how would you delete a transaction from 3 years ago? $sql = "DELETE FROM tbl_transactions WHERE transDate < '$today <<- 3 years>> '" OR DIE (mysql_error()); im pretty new to sql and appriciate the help Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted August 4, 2007 Share Posted August 4, 2007 One way: $sql = "DELETE FROM tbl_transactions WHERE DATEDIFF(transDate,NOW()) > 1095; 3 x 365 = 1095. This doesn't account for leap year. -BSIS Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 4, 2007 Share Posted August 4, 2007 @guyfromfl - it would really help if we knew what format your database dates use. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.