title: Complex mysql query probably build subquery
body: <p>In my case, I have data from multiple tables that I want to extract a single query. It's about football statistics. In one minute table recorded the dates of the matches and the other recorded data and results of the matches.
  The problem is that I want to limit the applications of dates, not the number of matches, as in a day has a few games.
  Managed to build a complex query that displays all my data, but it displays the results on the number of games rather than the dates so I can not use limitation, because eating in this case becomes more games rather than dates.
  My question is is it possible to build an application that has a limitation on the dates and at the same time to display the results of all matches played in the dates?
  Here is the code of the application that I use now:</p>
  
  <pre><code>SELECT
              MAIN.id,
              SECTION.type,
              MAIN.date as date_,
              MAIN.prognosis,
              HOME_TEAM.team_name as home_team,
              GUEST_TEAM.team_name as guest_team,
              FIRST_INDEX.index as f_index,
              SECOND_INDEX.index as s_index,
              THIRD_INDEX.index as t_index,
              DATA.home_result,
              DATA.guest_result,
              DATA.coefficient,
              DATA.success,
              MAIN.total_coefficient,
              MAIN.total_success
  
          FROM ssdt_matches_main as MAIN
  
          LEFT JOIN ssdt_section_type as SECTION ON (MAIN.type_id = SECTION.id)
          LEFT JOIN ssdt_matches_data as DATA ON (DATA.matches_main_id = MAIN.id )
          LEFT JOIN ssdt_matches_teams as HOME_TEAM ON (HOME_TEAM.id = DATA.home_team_id )
          LEFT JOIN ssdt_matches_teams as GUEST_TEAM ON (GUEST_TEAM.id = DATA.guest_team_id )
          LEFT JOIN ssdt_matches_index as FIRST_INDEX ON (FIRST_INDEX.id = DATA.first_index_id )
          LEFT JOIN ssdt_matches_index as SECOND_INDEX ON (SECOND_INDEX.id = DATA.second_index_id )
          LEFT JOIN ssdt_matches_index as THIRD_INDEX ON (THIRD_INDEX.id = DATA.third_index_id ) 
  
  
          WHERE SECTION.type = 'Risk prognosis'
  
  
          ORDER BY MAIN.id DESC
  </code></pre>