diff options
Diffstat (limited to 'backend/query.sql')
| -rw-r--r-- | backend/query.sql | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/backend/query.sql b/backend/query.sql index 165c2c9..9b038a5 100644 --- a/backend/query.sql +++ b/backend/query.sql @@ -8,3 +8,13 @@ SELECT * FROM users JOIN user_auths ON users.user_id = user_auths.user_id WHERE users.username = $1 LIMIT 1; + +-- name: ListGames :many +SELECT * FROM games +LEFT JOIN problems ON games.problem_id = problems.problem_id; + +-- name: ListGamesForPlayer :many +SELECT * FROM games +LEFT JOIN problems ON games.problem_id = problems.problem_id +JOIN game_players ON games.game_id = game_players.game_id +WHERE game_players.user_id = $1; |
