このような投稿が他にもあることを知っているので、それらを使用しています。私は3つのテーブルを持っています:
users_info
user_id | user_name
blog_comments
comment_id | comment
blog_reply
user_id | comment_id | reply | reply_date
テーブルに参加して、user_name から users_info を取得し、blog_comments.comment_id で blog_reply を返そうとしています。
私が使ってきたもの: コメントとコメント返信用の mysql 構造
私はテーブルの結合に行き詰まっています。どんな助けも大歓迎です。
$get_replies = ("SELECT
blog_reply.user_id,
blog_reply.comment_id,
blog_reply.reply,
blog_reply.reply_date,
users_info.user_name AS user_name
FROM blog_reply
JOIN users_info ON blog_reply.user_id = users_info.user_id
LEFT JOIN blog_comments ON blog_reply.comment_id = blog_reply.comment_id
JOIN users_info ON blog_reply.user_id = users_info.user_id
WHERE blog_comments.comment_id = '{$comment_id}'
ORDER BY blog_reply.reply_date DESC");
$reply = mysql_query($get_replies);