select o.topic_id, count(o.post_id) count, min(o.post_id) first, t.post_id from sanitized o join sanitized t on o.post_id=t.post_id group by o.topic_id having t.post_id=first and count>1; select '-----------------------------------------'; select o.topic_id, count(o.post_id) count, min(o.post_id) first, t.post_id from sanitized o join sanitized t on o.post_id=t.post_id group by o.topic_id having t.post_id=first and count>1 order by topic_id desc;