What's the structure of a matchmaking server? This is my current structure of my matches table:

id, title, description, max_players, host_username, host_ip


and there's another table called matches_players:

match_id, player_username


This requires two queries to get the matches list and the player count of each one, so is there a better way?

I'm using:

SELECT COUNT(*) FROM `matches_players` WHERE `match_id` = ?


to get the number of players in a match.

Server inserts one row to the matches table, and then another one to add the host to the matches_players table.

It is working, but it makes the code more complex, saving the matches list, then doing lot of queries to get the players number. I was wondering if there is a better way?
Try this:-

SELECT id
      ,title
      ,DESCRIPTION
      ,max_players
      ,host_username
      ,host_ip
      ,(
           SELECT COUNT(*)
           FROM   matches_players
           WHERE  match_id = id
       ) AS player_count
FROM   matches