匹配和左连接显示错误

时间:2011-01-24 06:23:01

标签: mysql sql full-text-search mysql-error-1064

所以我有两个这样的表,第一个表()和第二个表(

*

那么,有可能这样做吗?

1 个答案:

答案 0 :(得分:2)

您的FROM表格列表和JOINs必须位于查询的WHERE子句之前。

我不知道查询的其余部分是否正确,但这是正确的顺序:

SELECT id_maestro, nombre, materia 
FROM maestros_detalle AS t1 
LEFT JOIN (SELECT id, up, down FROM maestros) AS t2 ON t1.id_maestro = t2.id 
WHERE MATCH (t1.nombre, t1.materia) 
AGAINST ('quimica' IN BOOLEAN MODE)
ORDER BY t1.id_maestro

清理:

SELECT
  t1.id_maestro,
  t1.nombre,
  t1.materia,
  t2.up,
  t2.down
FROM
  maestros_detalle t1
LEFT JOIN
  maestros t2
ON 
  t1.id_maestro = t2.id
WHERE
  MATCH(t1.nombre, t1.materia) AGAINST ('quimica' IN BOOLEAN MODE)
ORDER BY
  t1.id_maestro