select * from yourtable
where fd_fatherPost is not null
order by fd_time desc
union
select * from yourtable
where fd_fatherPost is null
order by fd_time desc
select a.* from yourtable a left outer join yourtable b on b.fd_fatherPost=a.fd_postid order by b.fd_time desc,a.fd_time desc
b和a换个位置就可以了,如果没有回帖,b的时间为空,则走a的排序