Skip to content

Sorts elements of one array by corresponding elements of another array.

func.array_sortby(get_column(table, 'names'), get_column(table, 'scores'))
func.array_sortby(['c','a','b'], [3,1,2])
┌───────────────┐
['a','b','c']
└───────────────┘
ARRAY_SORTBY(<names>, <scores>)
SELECT ARRAY_SORTBY(['c','a','b'], [3,1,2]);
┌───────────────┐
│ ["a","b","c"] │
└───────────────┘