SQLinfo.ru - Все о MySQL

Форум пользователей MySQL

Задавайте вопросы, мы ответим

Вы не зашли.

#1 08.11.2021 06:40:47

kryl1979
Завсегдатай
Откуда: Россия
Зарегистрирован: 17.04.2016
Сообщений: 34

Проблема с SELECT SQL_CACHE

Доброе утро специалистам !

Есть код

$sql = "
    SELECT SQL_CACHE
        f.cat_id, f.forum_id, f.forum_status, f.forum_parent, f.show_on_index,
        p.post_id AS last_post_id, p.post_time AS last_post_time,
        t.topic_id AS last_topic_id, t.topic_title AS last_topic_title,
        u.user_id AS last_post_user_id, u.user_rank AS last_post_user_rank,
        IF(p.poster_id = $anon, p.post_username, u.username) AS last_post_username
    FROM         "
. BB_CATEGORIES . " c
    INNER JOIN   "
. BB_FORUMS . " f ON($forums_join_sql)
    $join_p_type "
. BB_POSTS . " p ON($posts_join_sql)
    $join_t_type "
. BB_TOPICS . " t ON($topics_join_sql)
    LEFT JOIN    "
. BB_USERS . " u ON(u.user_id = p.poster_id)
    ORDER BY c.cat_order, f.forum_order
"
;

$replace_in_parent = array(
    'last_post_id',
    'last_post_time',
    'last_post_user_id',
    'last_post_username',
    'last_post_user_rank',
    'last_topic_title',
    'last_topic_id',
);


В логах ошибка:

#001064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.cat_id, f.forum_id, f.forum_status, f.forum_parent, f.show_on_index, p.post_i' at line 2

SELECT SQL_CACHE f.cat_id, f.forum_id, f.forum_status, f.forum_parent, f.show_on_index, p.post_id AS last_post_id, p.post_time AS last_post_time, t.topic_id AS last_topic_id, t.topic_title AS last_topic_title, u.user_id AS last_post_user_id, u.user_rank AS last_post_user_rank, IF(p.poster_id = -1, p.post_username, u.username) AS last_post_username FROM bb_categories c INNER JOIN bb_forums f ON(f.cat_id = c.cat_id) LEFT JOIN bb_posts p ON(p.post_id = f.forum_last_post_id) LEFT JOIN bb_topics t ON(t.topic_last_post_id = p.post_id) LEFT JOIN bb_users u ON(u.user_id = p.poster_id) ORDER BY c.cat_order, f.forum_order


Подскажите, что не так ?
За ранние спасибо!

Неактивен

 

#2 08.11.2021 23:36:26

vasya
Архат
MySQL Authorized Developer
Откуда: Орел
Зарегистрирован: 07.03.2007
Сообщений: 5827

Re: Проблема с SELECT SQL_CACHE

А какая версия? В 8-ке SQL_CACHE не поддерживается.

Неактивен

 

Board footer

Работает на PunBB
© Copyright 2002–2008 Rickard Andersson