|
|
|
Ошибка Unknown column 't.entry_id' in 'on clause'
|
|||
|---|---|---|---|
|
#18+
Подскажите пожалуйста, что не так с кодом? Получаю ошибку: 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 ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 14.04.2016, 01:18 |
|
||
|
Ошибка Unknown column 't.entry_id' in 'on clause'
|
|||
|---|---|---|---|
|
#18+
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); ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 14.04.2016, 01:45 |
|
||
|
Ошибка Unknown column 't.entry_id' in 'on clause'
|
|||
|---|---|---|---|
|
#18+
retvizan, я ничего не понял, можно пожалуйста просто указать на ошибку? Буду благодарен. Ошибка именно в LEFT JOIN. Без него все работает, но нужно категорию подцепить. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 14.04.2016, 01:48 |
|
||
|
|

start [/forum/topic.php?fid=47&gotonew=1&tid=1831909]: |
0ms |
get settings: |
6ms |
get forum list: |
9ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
158ms |
get topic data: |
8ms |
get first new msg: |
5ms |
get forum data: |
2ms |
get page messages: |
33ms |
get tp. blocked users: |
2ms |
| others: | 210ms |
| total: | 437ms |

| 0 / 0 |
