mysql - How can I limit INNER JOIN? -
hi there way limit inner join?
so can limit output return last 5 match_ids?
select t.id , ff.match_id , ff.time football_teams t join ( select match_id , hometeam_id , time football_fixtures order time desc limit 5 ) ff on ff.hometeam_id = t.id t.id in ( ".$team_id_string." ) order t.id
i watch return array
something
array([football_team.id] = array(match_id[1],match_id[2],match_id[3],match_id[4],match_id[5],))
matt
by comments, assume 5 newest records in football_fixtures
table doesn't match other criteria in query, therefore - doesn't return anything. i'd suggest put limit in outer query make sure 5 records being selected :
select s.* (select football_teams.id, ff.match_id, ff.time football_teams inner join football_fixtures ff on hometeam_id=football_teams.id football_teams.id in ( ".$team_id_string." ) order ff.time limit 5) s order s.id
Comments
Post a Comment