acctman Posted March 12, 2009 Share Posted March 12, 2009 Hi I need help with a query that will cycle through the 'com_for' (userid) field and then only keep the latest 200 comments and delete everything after. Example: So if 'com_for' userid 39 has 250 comments then delete the oldest 50 comments. The com_time field holds the time in this format 1133173361 table: rate_picture_comments fields: com_id , com_for , com_comment , com_time This has been tried with sql only, (I posted in the Mysql section) but mysql wasn't able to handle multiple selects and deleting kept getting a unknown table error and after some researching online it was suggestion in a case like this its best to off load the process to a scripting language like php. Link to comment https://forums.phpfreaks.com/topic/149127-phpmysql-delete-oldest-entries/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.