Questa è la mia struttura della tabella:Perché questo codice SQL restituisce l'errore 1066 (tabella/alias non unica: 'utente')?
alt text http://img6.imageshack.us/img6/8730/articlek.jpg
Il messaggio di errore è:
# 1066 - Non unico tavolo/alias: 'utente'
Quello che segue è il mio codice.
SELECT article.* , section.title, category.title, user.name, user.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 ON article.modified_by = user.id
WHERE article.id = '1'
E, forse meglio: '... LEFT JOIN utente come autore ON article.author_id = author.id LEFT JOIN utente come modificatore ON article.modified_by = modifier.id'. Aliasing entrambi i riferimenti a 'utente', in altre parole, e dando loro nomi significativi (anche se io uso anche' u1' e 'u2' in tali situazioni). –
Grazie, è lavoro – neobeacon
Man questo è il vero affare INNER JOIN !! – Warface