What is the syntax to force the use of an index for a join in MySQL

The FORCE/USE/IGNORE goes after the table name you are joining, and after the alias if you’re using one.

SELECT
  t1.`id` AS `id_1`,
  t2.`id` AS `id_2`
FROM
  `table1` t1
LEFT OUTER JOIN
  `table2` t2
  FORCE INDEX FOR JOIN (`table1_id`)
  ON (t2.`table1_id` = t1.`id`)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)