22,209
社区成员
发帖
与我相关
我的任务
分享
select b.id, b.articleId, b.commentId, b.commentTime from Comment a , Comment b
where ((a.id = b.id ) or (a.id = b.commentId)) and a.articleId = 'bd3f3e72359c96e201359e85f0940001' and b.hidden = '1'
order by a.commentTime, b.commentTime asc;
select c.* from Comment c where c.articleId = 'bd3f3e72359c96e201359e85f0940001'
union select a.* from Comment a inner loop join Comment b on a.commentId = b.id
and b.articleId = 'bd3f3e72359c96e201359e85f0940001'
order by case when r.commentId = 'null' then id else commentId end, r.commentTime, r.commentId asc;
order by
case when commentId='null' then id else commentId end,
commentId,
commenttime
order by
isnull(commentId,id),
commentId,
commenttime