我有2个表如下:
talk
表:
topic_id | topic_name | user_id (user who create topic)
1 test1 1
2 test2 2
talk_reply
表:
talk_reply_id | message | topic_id | user_id (user who reply to specific topic)
1 hi1 1 3
2 hi2 1 4
user
表:
user_id | name
1 mark
2 pedro
3 gates
4 steve
我的查询如下:
SELECT `tr`.`message`,
`tr`.`user_id`,
`tr`.`topic_id`,
`u`.`name`
FROM `talk_reply` AS `tr`
INNER JOIN `users` AS `u` ON tr.user_id = u.user_id WHERE (tr.topic_id=1)
但我只得到 1 个结果而不是 2 个,我在这里缺少什么?谢谢。