GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Any mySQL experts around? (https://gfy.com/showthread.php?t=483644)

Danielle 06-22-2005 03:12 AM

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

WarChild 06-22-2005 03:14 AM

Delete from <TABLENAME>
Where 1=1

margarita 06-22-2005 03:16 AM

first try select * from table where datecolumn<now()-15 ...
if it works, replace to delete

UnifiedStats_John 06-22-2005 03:28 AM

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);

Danielle 06-22-2005 03:33 AM

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 06-22-2005 03:37 AM

Oh should that be DATE_SUB insteat of DATE_ADD???

Hugs,
Danielle

UnifiedStats_John 06-22-2005 03:37 AM

Quote:

Originally Posted by Danielle
Thanks. That looks like what I was looking for.

Hugs,
Danielle

no prob :)

UnifiedStats_John 06-22-2005 03:40 AM

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

Danielle 06-22-2005 03:54 AM

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


All times are GMT -7. The time now is 03:42 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123