JavaScript: Order the results

Order the query result by column.

Parameters

Examples

With `select()`

const \{ data, error \} = await supabase
  .from('countries')
  .select('id', 'name')
  .order('id', \{ ascending: false \})

On a referenced table

  const \{ data, error \} = await supabase
    .from('countries')
    .select(`
      name,
      cities (
        name
      )
    `)
    .order('name', \{ referencedTable: 'cities', ascending: false \})