我需要按 ASC 顺序检索最后 3 行,所以这是最终查询:
SELECT c.comment_id,c.comment_message,c.comment_date,u.user_id,u.first_name,u.last_name,p.profile_picture_path
FROM
(SELECT c.comment_id,c.comment_message,c.comment_date,u.user_id,u.first_name,u.last_name,p.profile_picture_path
FROM posts_comments c,users u,users_profile_pictures p
WHERE c.user_id = u.user_id AND u.user_id = p.user_id AND c.post_id = '82'
ORDER BY c.comment_date DESC
LIMIT 3)
ORDER BY c.comment_date ASC
我知道这里有问题,我收到此错误:Every derived table must have its own alias
. 当适当的表指出它们时,如何从 Select 语句中选择列?意思是,我该如何选择c.comment_id
?