Second order isn't applied

Same as Why second order not work?

If first order is val(), second order is ignored.

This is what I’m trying to do

orderdesc: val(SECTIONS_COUNT), orderasc: name

Using Dgraph v23.1.1

Ping pong :slight_smile: Is there a way to do this except doing the sorting in code?

The doc provides the supported syntax:
https://dgraph.io/docs/query-language/sorting/

q(func: ..., orderasc: predicate)
q(func: ..., orderdesc: val(varName))
predicate (orderdesc: predicate) { ... }
predicate @filter(...) (orderasc: N) { ... }
q(func: ..., orderasc: predicate1, orderdesc: predicate2)

ordering by val(var) and by a predicate is not supported.

Could you create an enhancement request?

Thanks for confirming. Posted here Support order by combination of val() and predicate.