Mysql
 sql >> Database >  >> RDS >> Mysql

Sottoselezionare o non sottoselezionare?

Prova a spostare l'IN nella clausola FROM come tabella derivata inline

SELECT 
    id_topic, id_member_comment, pd.username, dt_post
FROM
   (
   SELECT MAX(last_id_comment) AS id_comment
   FROM forum_topic 
   GROUP BY cat_id
   ) AS foo
   JOIN
   forum_comment c ON foo.id_comment = c.id_comment --AND a cat_id join too?
   LEFT JOIN
   persondata pd ON c.id_member_comment = pd.id_member;