0

这有效:

SELECT `nid`, CONCAT('node/', `nid`) AS `vpath`, `title`
FROM `node` WHERE MATCH(`title`) AGAINST ('a*' IN BOOLEAN MODE)

那么为什么这不起作用:

SELECT `nid`, CONCAT('node/', `nid`) AS `vpath`, `title`, `alias`
FROM `node` WHERE MATCH(`title`) AGAINST ('a*' IN BOOLEAN MODE)
LEFT JOIN `url_alias` ON `url_alias`.`source` = `vpath`
4

1 回答 1

0

JOIN 应该放在 WHERE 语句之前。尝试:

SELECT `nid`, CONCAT('node/', `nid`) AS `vpath`, `title`, `alias`
FROM `node`
LEFT JOIN `url_alias` ON `url_alias`.`source` = `vpath`
WHERE MATCH(`title`) AGAINST ('a*' IN BOOLEAN MODE)

MYSQL 选择语法

于 2012-07-13T22:43:44.013 回答