我不认为我的标题解释得很好:)
我有一个查询,其中有很多连接。
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
问题是我只想每行返回 1 个游戏图像。游戏本身基本上是发布日期最近的 20 款游戏。但是如果我加入 game_image (type=3),那么如果该游戏有多个图像,它将为同一个游戏带回多行。
我真的只想选择最近的 20 场比赛,然后为每场比赛拉回第一张图片。这是进入前 20 名游戏的 RSS 提要,这就是为什么我想这样做(以防有人想知道):)
我一直在试图解决这个问题......我知道我以前做过,但我的大脑并没有提醒我我做了什么:)
谢谢!