J'utilise l'instruction SQL suivante:joindre plusieurs tables à la fois:
SELECT reply.id, reply.content, author.username
FROM thread, reply, author
JOIN thread_reply ON thread.id = thread_reply.thread_id
JOIN reply ON thread_reply.reply_id = reply.id
JOIN author_reply ON thread.id = author_reply.thread_id
JOIN author ON author_reply.author_id = author.id
WHERE thread.id = '40'
J'ai les tables follwing:
thread_reply: thread_id, reply_id
reply: id, content, created (timestamp)
author: id, username, password_hash, salt #etc
thread: id, content, created
author_reply: author_id, reply_id
Je continue à obtenir l'erreur suivante:
#1066 - Not unique table/alias: 'reply'
Oh et j'utilise MySQL.
Vous ne devez pas sélectionner explicitement de '' reply' et author' si vous allez les rejoindre. –
Ma tête me fait mal ... –
Quel est le but des tables 'thread_reply' et' author_reply'? Peut-on répondre à plusieurs threads? Peut-on répondre à plusieurs auteurs? – Quassnoi