RE: Deleting topics older than 2 hours?

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

 



[snip]
> =others, eg MySQL, do not, and thus unless MySQL's last DELETE format
> option
> works sufficiently well, the best option might be two DELETE's: the
first
> per your suggestion above and the second to remove all entries in
posts
> that
> no longer join to a topics row.

But you can't join on a DELETE, either (in MySQL at least). So you're
left with writing a whole PHP script to do it. Run a SELECT to get all
of the topics with IDs older than two hours. Roll up all of those IDs
into a comma separated list, like (1,2,3,4) etc. Then run two DELETE
queries on each table.

DELETE FROM topics WHERE id IN $id_string
DELETE FROM posts WHERE topic IN $id_string

Is there a better way to organize your data so this is all in one
table?? Maybe just add another column to say whether the "message" is a
topic or a post? Then your deletes could be done with single query,
probably.

---John Holmes...



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux