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.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 06-22-2005, 03:12 AM   #1
Danielle
Confirmed User
 
Danielle's Avatar
 
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
Danielle is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-22-2005, 03:14 AM   #2
WarChild
Let slip the dogs of war.
 
WarChild's Avatar
 
Industry Role:
Join Date: Jan 2003
Location: Bermuda
Posts: 17,263
Delete from <TABLENAME>
Where 1=1
__________________
.
WarChild is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-22-2005, 03:16 AM   #3
margarita
Confirmed User
 
Join Date: Jun 2003
Posts: 917
first try select * from table where datecolumn<now()-15 ...
if it works, replace to delete
__________________
Check out my favourite kinky sponsor and must-have tool Nifty Stats
margarita is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-22-2005, 03:28 AM   #4
UnifiedStats_John
Confirmed User
 
Join Date: May 2005
Posts: 271
Quote:
Originally Posted by Danielle
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
to view the data:
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);
__________________

Last edited by UnifiedStats_John; 06-22-2005 at 03:30 AM..
UnifiedStats_John is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-22-2005, 03:33 AM   #5
Danielle
Confirmed User
 
Danielle's Avatar
 
Join Date: Jun 2002
Location: My Coffin
Posts: 1,227
Quote:
Originally Posted by UnifiedStats_John
to view the data:
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);
Thanks. That looks like what I was looking for.

Hugs,
Danielle
Danielle is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-22-2005, 03:37 AM   #6
Danielle
Confirmed User
 
Danielle's Avatar
 
Join Date: Jun 2002
Location: My Coffin
Posts: 1,227
Oh should that be DATE_SUB insteat of DATE_ADD???

Hugs,
Danielle
Danielle is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-22-2005, 03:37 AM   #7
UnifiedStats_John
Confirmed User
 
Join Date: May 2005
Posts: 271
Quote:
Originally Posted by Danielle
Thanks. That looks like what I was looking for.

Hugs,
Danielle
no prob
__________________
UnifiedStats_John is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-22-2005, 03:40 AM   #8
UnifiedStats_John
Confirmed User
 
Join Date: May 2005
Posts: 271
Quote:
Originally Posted by Danielle
Oh should that be DATE_SUB insteat of DATE_ADD???

Hugs,
Danielle
it will just add the -15...so it will work fine...either way
__________________
UnifiedStats_John is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-22-2005, 03:54 AM   #9
Danielle
Confirmed User
 
Danielle's Avatar
 
Join Date: Jun 2002
Location: My Coffin
Posts: 1,227
Quote:
Originally Posted by UnifiedStats_John
it will just add the -15...so it will work fine...either way
Thanks. It makes total sinse to me now.

Hugs,
Danielle
Danielle is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.