1
所有標籤我有一個類似的表結構,是這個問題,接受的答案:Recommended SQL database design for tags or tagging獲取在PHP
除礦
thread, thread_tags and tags
使用我可以得到一個標籤與各個線程關聯的下列SQL命令,我如何獲得與每個線程關聯的所有標籤?
SELECT
thread.id AS t_id,
thread.title,
thread.content,
author.username,
author.id AS a_id
FROM thread
INNER JOIN author
ON author_id = author.id
INNER JOIN thread_tags
ON thread_id = thread.id
INNER JOIN tags
ON tag_id = tags.id
ORDER BY thread.created DESC
Post:http://stackoverflow.com/questions/4612353/inner-joins-in-php ??? ??? – Chandu 2011-01-06 07:18:53
什麼是`author_id`?你應該把表名放在任何地方,或者更好的是縮短名字(例如`TH從線程TH INNER JOIN作者A上TH.author_id = A.id` – 2011-01-06 07:23:53