Join 联接问题-如何每行仅恢复1个外部联接

Join 联接问题-如何每行仅恢复1个外部联接,join,Join,我不认为我的头衔能很好地解释这一点:) 我有一个查询,其中有很多连接 SELECT sof_slot_games.launch_date, sof_slot_games.game_name, sof_reviews.review_content, sof_slot_games.slot_game_id, sof_slot_game_details.no_of_reels, sof_slot_game_details.paylines, sof_reviews.reg_timestamp, sof

我不认为我的头衔能很好地解释这一点:)

我有一个查询,其中有很多连接

SELECT
sof_slot_games.launch_date,
sof_slot_games.game_name,
sof_reviews.review_content,
sof_slot_games.slot_game_id,
sof_slot_game_details.no_of_reels,
sof_slot_game_details.paylines,
sof_reviews.reg_timestamp,
sof_developers.developer_name,
sof_slot_games.game_slug,
sof_slot_game_images.game_image
FROM
sof_reviews
Inner Join sof_slot_games ON sof_slot_games.slot_game_id = sof_reviews.slot_game_id
Inner Join sof_slot_game_details ON sof_slot_games.slot_game_id = sof_slot_game_details.slot_game_id
Inner Join sof_developers ON sof_slot_games.developer_id = sof_developers.developer_id
left outer Join sof_slot_game_images ON sof_reviews.slot_game_id = sof_slot_game_images.slot_game_id
WHERE
sof_slot_game_images.image_type_id =  '3'
ORDER BY
sof_slot_games.launch_date DESC
limit 0,20
问题是我想每行只返回一张游戏图片。游戏本身基本上是最新的20个游戏发布日期。但是如果我加入游戏_图像(type=3),那么如果该游戏有多个图像,它将为同一游戏返回多行

我只想挑选最近的20场比赛,然后为每一场比赛收回第一张图片。这是进入前20名游戏的RSS提要,这就是为什么我想这样做(以防有人怀疑):)

我一直在想办法。。。我知道我以前做过,但我的大脑并没有提醒我做过什么:)


谢谢

有什么想法吗?顶部的外部连接是问题所在。。。我原以为这会通过datatable中的一个相关图像加入前20名,但这并不是它的工作原理。我找到了答案。我在select语句中添加了一个子查询,以根据图像类型(限制为1)从图像中进行选择。这让我得到了我所需要的。谢谢