Skip to main content

order()

Orders the result with the specified column.

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

Parameters#

  • columnrequiredobject

    The column to order on.

  • __namedParametersrequiredobject

    No description provided.

      Properties
    • nullsFirstrequiredboolean

      If true, nulls appear first.

    • foreignTablerequiredundefined | string

      The foreign table to use (if column is a foreign column).

    • ascendingrequiredboolean

      If true, the result will be in ascending order.

Examples#

With select()#

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

With embedded resources#

const { data, error } = await supabase
.from('countries')
.select('name, cities(name)')
.eq('name', 'United States')
.order('name', {foreignTable: 'cities'})