I have two tables: one in which I register the games of the round and the other that registers the guesses for these games. I want to show a table where the game appears, the guess of user X and if it has already been played, its result too. At the moment, the solution I found is as follows:
I select all games from round X. Then I do a while and inside it I make a new selection to find that user's guess. It is working normally, but I fear it is something wrong by the large amount of queries being made. If a round has 16 games, I once select all the games from it + 16 selections from each guess. That was the other queries on the page. Is there any leaner solution? Is it possible with two selects to just grab all the necessary info?
Edit:
There are 2 tables relevant to this question:
Games table: id - timecasa - timefora - result
Suggestions:
id - idjogo (even id of the games table) - idusuario (who made the guess) - choose (if he chose the home team or away) - result