select * from 主题表order by isnull((select max(回帖时间) from 回帖表 where 关联条件),发表时间)

解决方案 »

  1.   

    select * from 主题表order by isnull((select max(回帖时间) from 回帖表 where 关联条件),发表时间) desc
      

  2.   

    用union all将两个时间联起来排序
      

  3.   

    select 时间
    from (
             select 最后回复时间 as 时间 from tablea
             union all     
             select 发表主题时间 as 时间 from tableb
    ) a 
    order by  时间 desc
      

  4.   

    select 作者 回复次数 人气   最后更新 时间=max(回贴时间)
    from 主题表 join 回贴表
    order by 时间 DESC