09-03-2010, 09:03 PM
Code PHP :
<?php
SELECT t.id as topic_id, m.pseudo AS master, u.pseudo AS user
FROM `pm_topics` as t
INNER JOIN users as m ON (t.master_id=m.id)
LEFT JOIN pm_topics_users AS r ON (r.topic_id=t.id)
INNER JOIN users as u ON (r.user_id=m.id)
Mais bon j'aurais plutôt tendance à décomposer:
Code PHP :
<?php
SELECT t.id as topic_id, u.pseudo AS user
FROM `pm_topics` as t
LEFT JOIN pm_topics_users AS r ON (r.topic_id=t.id)
INNER JOIN users as u ON (r.user_id=m.id)