0

I have a table Requests with 2 foreign keys referencing auth.users and Categories

Requests
------------------------------------------------------------------------------
| user_id (= auth.users.id) | title | description | category_id (= categories.id)
|
|

Categories
-------------------------------
| id | category | description


I can't seem to return category from Categories the way it's described in the docs :

let { data: requests, error } = await supabase
  .from('requests')
  .select(`
    some_column,
    other_table (
      foreign_key
    )
  `)

tried these and other similar variations

const { data, error } = await supabase.from('requests').select(`
  title,
  description,
  categories:category_id ( category )

`)

const { data, error } = await supabase.from('requests').select(`
  title,
  description,
  categories ( category )

`)

but all i get is this, and i have no clue how to get the column i want from the other table!

data: [
    {
      title: 'title',
      description: 'description',
      categories: null
    }
  ],
lumikso
  • 3
  • 3

0 Answers0