MySQL Subquery LIMIT

后端 未结 1 1021
星月不相逢
星月不相逢 2020-12-01 14:24

As the title says, I wanted a workaround for this...

SELECT 
  comments.comment_id,
  comments.content_id,
  comments.user_id,
  comments.`comment`,
  commen         


        
相关标签:
1条回答
  • 2020-12-01 15:15
    SELECT  comments.comment_id,
            comments.content_id,
            comments.user_id,
            comments.`comment`,
            comments.comment_time,
            NULL
    FROM    (
            SELECT  content.content_id
            FROM    content
            WHERE   content.user_id = 1
            LIMIT 10
            ) q
    JOIN    comments
    ON      comments.content_id = q.content_id
    

    You probably will want to add an ORDER BY into the nested query.

    0 讨论(0)
提交回复
热议问题