简体   繁体   中英

Match Against and left join shows error

So I have two tables like this, first table ( ) and second table ( )

*

So, it's possible to do this?

Your FROM table list and JOINs must come before the WHERE clause of the query.

I don't know if the rest of the query was right, but this is it in the right order:

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

Cleaned up:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM