From 0a1476024fd30adeb80dcf71ce8ac487e63bc20f Mon Sep 17 00:00:00 2001 From: Jitesh Yadav <100085223+slowlydeveloped@users.noreply.github.com> Date: Tue, 2 Jul 2024 05:02:08 +0530 Subject: [PATCH] Update joins-and-nesting.mdx (#27311) I have changed the text description of the ON clause section and added the code for kotlin and GraphQL. --- .../guides/database/joins-and-nesting.mdx | 70 ++++++++++++++++++- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/apps/docs/content/guides/database/joins-and-nesting.mdx b/apps/docs/content/guides/database/joins-and-nesting.mdx index c151250e9ae..df1c2af1c1b 100644 --- a/apps/docs/content/guides/database/joins-and-nesting.mdx +++ b/apps/docs/content/guides/database/joins-and-nesting.mdx @@ -343,9 +343,9 @@ create table shifts ( ); ``` -In this case, you need to explicitly define the join because the joining column on `shifts` is ambiguous. +In this case, you need to explicitly define the join because the joining column on `shifts` is ambiguous as they are both referencing the `scans` table. -To fetch all the `shifts` with `scan_id_start` related to a specific `scan`, use the following syntax: +To fetch all the `shifts` with `scan_id_start` and `scan_id_end` related to a specific `scan`, use the following syntax: + + + +```kotlin +val data = supabase.from("shifts").select(Columns.raw(''' + *, + scans:scan_id_start ( + id, + user_id, + badge_scan_time + ), +scans:scan_id_end ( + id, + user_id, + badge_scan_time + ) +''')); +``` + + + + +```javascript +const Query = ` + query { + shiftsCollection { + edges { + node { + id + user_id + attendance_status + scan_id_start { + id + user_id + badge_scan_time + } + scan_id_end { + id + user_id + badge_scan_time + } + } + } + } + } +` +``` +