![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Jun 2002
Location: My Coffin
Posts: 1,227
|
Any mySQL experts around?
Anyone know how to do this in mySQL?
I have a table with a datetime column and need to delete all entries that are older than 15 days. Hugs, Danielle |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Let slip the dogs of war.
Industry Role:
Join Date: Jan 2003
Location: Bermuda
Posts: 17,263
|
Delete from <TABLENAME>
Where 1=1
__________________
. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Jun 2003
Posts: 917
|
first try select * from table where datecolumn<now()-15 ...
if it works, replace to delete |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 | |
Confirmed User
Join Date: May 2005
Posts: 271
|
Quote:
select * from tablename where datetime < DATE_ADD(now(), interval -15 day) order by datetime; and if it looks right, to delete: delete from tablename where datetime < DATE_ADD(now(), interval -15 day); |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |
Confirmed User
Join Date: Jun 2002
Location: My Coffin
Posts: 1,227
|
Quote:
Hugs, Danielle |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Join Date: Jun 2002
Location: My Coffin
Posts: 1,227
|
Oh should that be DATE_SUB insteat of DATE_ADD???
Hugs, Danielle |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 | |
Confirmed User
Join Date: May 2005
Posts: 271
|
Quote:
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 | |
Confirmed User
Join Date: May 2005
Posts: 271
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 | |
Confirmed User
Join Date: Jun 2002
Location: My Coffin
Posts: 1,227
|
Quote:
Hugs, Danielle |
|
![]() |
![]() ![]() ![]() ![]() ![]() |