日期:2014-05-17 浏览次数:20676 次
SELECT c.UserId AS id, u.userimg AS img, u.UserName AS name,
c.CommentContent AS comment, c.CommentTime AS time, c.PostId,
c.MsgType AS mt
FROM tb_Comment c INNER JOIN
tb_User u ON c.UserId = u.UserId
WHERE (c.PostId = 95)
GROUP BY c.UserId, u.userimg, u.UserName, c.CommentContent, c.CommentTime,
c.PostId, c.MsgType
ORDER BY c.UserId, c.CommentTime
SELECT c.UserId AS id, u.userimg AS img, u.UserName AS name,
c.CommentContent AS comment, c.CommentTime AS time, c.PostId,
c.MsgType AS mt
FROM tb_Comment c INNER JOIN
tb_User u ON c.UserId = u.UserId
join (select UserId,min(commentTime) minTime from tb_comment group by UserId ) as x
on c.UserId=x.UserId
WHERE (c.PostId = 95)
GROUP BY c.UserId, u.userimg, u.UserName, c.CommentContent, c.CommentTime,
c.PostId, c.MsgType
ORDER BY x.minTime,c.UserId, c.CommentTime