Вверх ↑
Администрация
Ответов: 15295
Рейтинг: 1519
#1: 2008-10-15 10:55:21 ЛС | профиль | цитата
есть желание подумать над коррекцией запроса?

#sql
SELECT t.topic_id, t.title, t.posts, IF(p1.user = -1, p1.guest, u1.name) AS author, t.views, IF(p2.user = -1, p2.guest, u2.name) AS name, p2.time, t.type, t.status FROM $db_new_posts np, $db_topics t, $db_posts p1, $db_posts p2, $db_users u1, $db_users u2 WHERE np.user_id = %user% AND np.topic_id = t.topic_id AND t.first_post = p1.post_id AND p1.user = u1.user_id AND t.last_post = p2.post_id AND p2.user = u2.user_id AND t.topic_id NOT IN(SELECT topic_id FROM $db_pms) GROUP BY np.topic_id ORDER BY p2.post_id DESC LIMIT 20
карма: 27
0