0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

supabaseでテーブルからselectする際に深くネストする方法

Posted at

結論

const { data, error } = await supabase
    .from("table1")
    .select(`
        *,
        table2(
            *,
            table3(*)
        )
    `);

console.log(data)

結果

{
    "table1_column1" : "value1",
    "table1_column2" : "value1",
    "table2" : {
        "table2_column1" : "value2",
        "table2_column2" : "value2",
        "table3" : {
            "table3_column1" : "value3",
            "table3_column2" : "value3"
        }
    }
}

公式サイトには載っておらず、困っていたところこれでデータが取れるようになりました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?