I have a table where member_id gets inserted for different user. I want to delete the entries of member_id except recent two entries for each member in the table.
Tell me the optimized way because it's a very large table.
i.e. table should开发者_运维知识库 have 2 recent entries for each member.
I need query in mysql 4.X.X.X
$recent = $this->db->insert_id();
$sql = delete from tbl_manager where sno<$recent-2;
$this->db->query();
精彩评论