Search code examples
mysqlsqlfull-text-searchmysql-error-1064

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?


Solution

  • 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