Re: How to delete 3 months old records in my database?
| From: | Simon Schick | Date: | Fri, 02 Aug 2013 12:35:52 +0000 |
| Subject: | Re: How to delete 3 months old records in my database? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-321761@lists.php.net to get a copy of this message | ||
On Fri, Aug 2, 2013 at 2:02 PM, Karl-Arne Gjersøyen <karlarneg@gmail.com> wrote:
>
> 2013/8/2 Dušan Novaković <ndusan@gmail.com>
>
> > $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