forked from rocketacademy/webpack-mvc-base-bootcamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sql
More file actions
19 lines (19 loc) · 750 Bytes
/
test.sql
File metadata and controls
19 lines (19 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
SELECT
"game"."id",
"game"."black_id" AS "blackId",
"game"."white_id" AS "whiteId",
"game"."winner_id" AS "winnerId",
"blackPlayer"."id" AS "blackPlayer.id",
"blackPlayer->user_status"."last_action" AS "blackPlayer.user_status.lastAction",
"blackPlayer->user_status"."in_game" AS "inGame"
FROM
"games" AS "game"
LEFT OUTER JOIN (
"users" AS "blackPlayer"
INNER JOIN "user_statuses" AS "blackPlayer->user_status" ON "blackPlayer"."id" = "blackPlayer->user_status"."user_id"
AND "blackPlayer->user_status"."last_action" >= '2021-10-12 06:12:25.103 +00:00'
AND "blackPlayer->user_status"."in_game" = false
) ON "game"."black_id" = "blackPlayer"."id"
WHERE
"game"."white_id" IS NULL
AND "game"."winner_id" IS NULL;