日期:2014-05-20 浏览次数:20932 次
String sql = "select " +
"thread.id, " +
"thread.title, " +
"(select count(id) from comment where thread=thread.id) as reply, " +
"(select username from user where id=thread.user) as author, " +
"thread.hit, " +
"(select top 1 create_time from comment where comment.thread=thread.id order by create_time desc) as create_time, " +
"(select top 1 user.username from comment,user where comment.thread=thread.id and comment.user=user.id order by create_time desc) as user " +
"from thread" +
"order by user desc";