sql >> Base de Datos >  >> RDS >> Mysql

¿Subseleccionar o no subseleccionar?

Intente mover IN a la cláusula FROM como una tabla derivada en línea

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;