Salve a tutti! Ho un problema con un update MySQL affetta da JOIN.
Di fatti, se eseguo la seguente select:
Codice:
SELECT * FROM `site_animes` AS `Row` LEFT JOIN (SELECT `forum_users`.`user_id`, `forum_users`.`username` FROM `forum_users` AS `forum_users`) AS `User` ON `Row`.`user_id` = `User`.`user_id` LEFT JOIN `site_anime_producers` AS `AnimeProducer` ON `Row`.`producer_id` = `AnimeProducer`.`id` LEFT JOIN `site_languages` AS `Language` ON `Row`.`language_id` = `Language`.`id` WHERE `Row`.`id` = 2
Ottengo dei risultati validi, ma se provo ad eseguire la seguente update:
Codice:
UPDATE `site_animes` AS `Row`, `forum_users` AS `User`, `site_anime_producers` AS `AnimeProducer`, `site_languages` AS `Language` SET `AnimeProducer`.`name` = 'Fairy Tail' WHERE `Row`.`id` = '2' AND `Row`.`user_id` = `User`.`user_id` AND `Row`.`producer_id` = `AnimeProducer`.`id` AND `Row`.`language_id` = `Language`.`id`
oppure la seguente:
Codice:
UPDATE `site_animes` AS `Row` LEFT JOIN (SELECT `forum_users`.`user_id`, `forum_users`.`username` FROM `forum_users` AS `forum_users`) AS `User` ON `Row`.`user_id` = `User`.`user_id` LEFT JOIN `site_anime_producers` AS `AnimeProducer` ON `Row`.`producer_id` = `AnimeProducer`.`id` LEFT JOIN `site_languages` AS `Language` ON `Row`.`language_id` = `Language`.`id` SET `AnimeProducer`.`name` = 'Fairy Tail' WHERE `Row`.`id` = '2'
Mi ritorna sempre 0 righe modificate, anche se la riga con id 2 esiste.... sapete dirmi il perchè per favore?
Tabella site animes:
Ciao,
Mattia.