sql2 = select * from g5_write_rankup_jee1 where wr_parent = '1' and wr_is_comment = 1 order by wr_comment, wr_comment_reply sql5 = SELECT * FROM g5_write_rankup_jee1 WHERE wr_is_comment = 0 and wr_id not in (10) order by wr_num, wr_reply limit 29, 30