|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to delete from mysql which entry of database based on date?
|
|
#2
|
||||
|
||||
|
Just use your date column in the where clause.
DELETE FROM your_table WHERE date<NOW(); DELETE FROM your_table WHERE date < NOW() - INTERVAL 5 DAYS; DELETE FROM your_table WHERE date < NOW() - INTERVAL 1 MONTH; Those will delete everything with a date column before now, before 5 days ago, and anything more than a month old. Look at the date and time functions in the MySQL manual to see all of the things to can do with dates. http://www.mysql.com/documentation/..._time_functions ---John Holmes... ------------------ ************************************************************* * The manual can probably answer 90% of your questions... * * PHP Manual. www.php.net/manual * MySQL Manual: www.mysql.com/documentation/mysql/bychapter ************************************************************* |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > delete from mysql based on date |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|