Difficult SQL-Query <p>i have 2 tables i.e. table 1 calls game and table 2 calls game_medias</p> <p>structure table 1 (game)</p> <pre><code>-id -genre_id -title -created </code></pre> <p>etc.</p> <p>structure table 2 (game_medias)</p> <pre><code>-id -game_id -thumb </code></pre> <p>etc</p> <p>example query:</p> <pre><code>select g.id,g.genre_id,g.title, gm.* from games g inner join game_medias as gm group by rand(g.id) limit 8; </code></pre> <p>is it possible to make a query with a extra like " where g.id = '2' " - get the genre_id from it and get into the random 8 only "items" with this genre_id ? i'm not sure if the join is the right solution - maybe someone knows a better way?</p> <p>regards</p>