Skip to main content
Version: v2 RC

limit()

Limit the query result by count.

const { data, error } = await supabase
.from('countries')
.select('name')
.limit(1)

Parameters

  • countrequirednumber

    The maximum number of rows to return

  • optionsrequiredobject

    Named parameters

      Properties
    • foreignTableoptionalstring

      Set this to limit rows of foreign tables instead of the current table

Examples

With select()

const { data, error } = await supabase
.from('countries')
.select('name')
.limit(1)

On a foreign table

const { data, error } = await supabase
.from('countries')
.select(`
name,
cities (
name
)
`)
.limit(1, { foreignTable: 'cities' })