Re: How to delete 3 months old records in my database?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yeah, just spelling mistake :-)
And yes, it should be:

$query = "DELETE FROM `__table_name__` WHERE `__date__` <= NOW() - INTERVAL
3 MONTH"


Cheers ;-)


On Fri, Aug 2, 2013 at 2:35 PM, Simon Schick <simonsimcity@xxxxxxxxx> wrote:

> On Fri, Aug 2, 2013 at 2:02 PM, Karl-Arne Gjersøyen <karlarneg@xxxxxxxxx>
> wrote:
> >
> > 2013/8/2 Dušan Novaković <ndusan@xxxxxxxxx>
> >
> > > $query = "DELECT FROM `__table_name__` WHERE `__date__` BETWEEN NOW() -
> > > INTERVAL 3 MONTH AND NOW()"
> > >
> >
> > This delete everything from now and 3months backwards. I want to store 3
> > months from now and delete OLDER than 3 months old records.
> >
> > Karl
>
> Hi, Karl
>
> You're right, but restructuring, to get it the way you want, isn't be
> that hard, is it? :)
>
> $query = "DELETE FROM `__table_name__` WHERE `__date__` < NOW() -
> INTERVAL 3 MONTH"
>
> @Dusan,
> Btw: What is "DELECT"? I assume it should've been "DELETE", right?
>
> Bye
> Simon
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
mob:   + 46 7 230 230 19
web:   http://novakovicdusan.com

Please consider the environment before printing this email.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux