Order the query result by column
.
You can call this method multiple times to order by multiple columns.
You can order referenced tables, but it only affects the ordering of the parent table if you use !inner
in the query.
The column to order by
Named parameters
const { data, error } = await supabase
.from('characters')
.select('id, name')
.order('id', { ascending: false })
const { data, error } = await supabase
.from('orchestral_sections')
.select(`
name,
instruments (
name
)
`)
.order('name', { referencedTable: 'instruments', ascending: false })
const { data, error } = await supabase
.from('instruments')
.select(`
name,
section:orchestral_sections (
name
)
`)
.order('section(name)', { ascending: true })