用户表(userinfo)
userID
userName
评论表(comment)
commentID
commentContent(评论内容)
commentator(评论人ID)
coverCommentator(被评论人ID)
其中评论人ID和被评论人ID都是用户ID
请问一下,联表查询怎么查
弄成这样的
用户表(userinfo)
userID
userName
评论表(comment)
commentID
commentContent(评论内容)
commentator(评论人ID)
coverCommentator(被评论人ID)
其中评论人ID和被评论人ID都是用户ID
请问一下,联表查询怎么查
弄成这样的
select b.name,c.name,a.commentContent from comment a left join userinfo b on a.commentator = b.id
left join userinfo c on a.coverCommentator = c.id
你试试 可以不