powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / MySQL [игнор отключен] [закрыт для гостей] / Ошибка Unknown column 't.entry_id' in 'on clause'
4 сообщений из 4, страница 1 из 1
Ошибка Unknown column 't.entry_id' in 'on clause'
    #39215159
mast88
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Подскажите пожалуйста, что не так с кодом? Получаю ошибку: Unknown column 't.entry_id' in 'on clause'

Я так понимаю проблема в строке LEFT JOIN exp_category_posts ON t.entry_id = exp_category_posts.entry_id

Вот полный запрос.
SELECT t.entry_id AS entry_id, t.title AS title, t.weblog_id, t.url_title AS url_title, t.entry_date AS entry_date,COUNT(*)
FROM exp_weblog_titles AS t, (select title, entry_date, entry_id from exp_weblog_titles where weblog_id=3) as newsreal
LEFT JOIN exp_category_posts ON t.entry_id = exp_category_posts.entry_id
WHERE newsreal.title LIKE CONCAT('%', t.title, '%') AND t.site_id IN ('1') AND t.status = 'open' AND t.weblog_id = 13 AND newsreal.entry_date > UNIX_TIMESTAMP() - 3600*24*7 AND exp_category_posts.cat_id = 59
GROUP BY title
ORDER BY COUNT(*) DESC LIMIT 20
...
Рейтинг: 0 / 0
Ошибка Unknown column 't.entry_id' in 'on clause'
    #39215167
retvizan
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
mast88,

http://dev.mysql.com/doc/refman/5.6/en/join.html

Previously, the comma operator (,) and JOIN both had the same precedence, so the join expression t1, t2 JOIN t3 was interpreted as ((t1, t2) JOIN t3). Now JOIN has higher precedence, so the expression is interpreted as (t1, (t2 JOIN t3)). This change affects statements that use an ON clause, because that clause can refer only to columns in the operands of the join, and the change in precedence changes interpretation of what those operands are.

Example:

CREATE TABLE t1 (i1 INT, j1 INT);
CREATE TABLE t2 (i2 INT, j2 INT);
CREATE TABLE t3 (i3 INT, j3 INT);
INSERT INTO t1 VALUES(1,1);
INSERT INTO t2 VALUES(1,1);
INSERT INTO t3 VALUES(1,1);
SELECT * FROM t1, t2 JOIN t3 ON (t1.i1 = t3.i3);

Previously, the SELECT was legal due to the implicit grouping of t1,t2 as (t1,t2). Now the JOIN takes precedence, so the operands for the ON clause are t2 and t3. Because t1.i1 is not a column in either of the operands, the result is an Unknown column 't1.i1' in 'on clause' error. To allow the join to be processed, group the first two tables explicitly with parentheses so that the operands for the ON clause are (t1,t2) and t3:

SELECT * FROM (t1, t2) JOIN t3 ON (t1.i1 = t3.i3);

Alternatively, avoid the use of the comma operator and use JOIN instead:

SELECT * FROM t1 JOIN t2 JOIN t3 ON (t1.i1 = t3.i3);
...
Рейтинг: 0 / 0
Ошибка Unknown column 't.entry_id' in 'on clause'
    #39215169
mast88
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
retvizan, я ничего не понял, можно пожалуйста просто указать на ошибку? Буду благодарен. Ошибка именно в LEFT JOIN. Без него все работает, но нужно категорию подцепить.
...
Рейтинг: 0 / 0
Ошибка Unknown column 't.entry_id' in 'on clause'
    #39215170
mast88
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Сделал. Просто поменял местами подзапрос
...
Рейтинг: 0 / 0
4 сообщений из 4, страница 1 из 1
Форумы / MySQL [игнор отключен] [закрыт для гостей] / Ошибка Unknown column 't.entry_id' in 'on clause'
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]