2

is it possible to sort a db query using the supabase api on a computed value?

something like:

await supabase
  .from('drives')
  .select('distance / time AS speed')
  .order('speed', { ascending: false })

(yes i know i could call a custom postgres function)

stuart
  • 1,785
  • 2
  • 26
  • 38
  • 1
    You can probably encapsulate this in an RPC. Or generate this column directly in the table and then be able to sort this. – Mansueli Feb 23 '23 at 19:24

0 Answers0