Mysql
 sql >> Database >  >> RDS >> Mysql

Perché questo codice SQL fornisce l'errore 1066 (tabella/alias non univoca:'utente')?

Devi dare un alias alla tabella utente la seconda volta che ti unisci ad essa

es.

SELECT article . * , section.title, category.title, user.name, u2.name 
FROM article 
INNER JOIN section ON article.section_id = section.id 
INNER JOIN category ON article.category_id = category.id 
INNER JOIN user ON article.author_id = user.id 
LEFT JOIN user u2 ON article.modified_by = u2.id 
WHERE article.id = '1'