Könnte mir vielleicht jmd. diese Sql Anweisung:
Code: Alles auswählen
$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_title, t.topic_last_post_id
FROM ((( " . FORUMS_TABLE . " f
LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
LEFT JOIN " . TOPICS_TABLE . " t ON t.topic_last_post_id = p.post_id )
ORDER BY f.cat_id, f.forum_order";
Code: Alles auswählen
$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_title, t.topic_last_post_id
FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . TOPICS_TABLE . " t
WHERE p.post_id = f.forum_last_post_id
AND u.user_id = p.poster_id
UNION (
SELECT f.*, NULL, NULL, NULL, NULL
FROM " . FORUMS_TABLE . " f
WHERE NOT EXISTS (
SELECT p.post_time
FROM " . POSTS_TABLE . " p
WHERE p.post_id = f.forum_last_post_id
)
)
ORDER BY cat_id, forum_order";