Hello :wave: I have a issue for sorting on joining...
# community-help
f
Hello 👋 I have a issue for sorting on joining collection. My collection has 2 relations fields,
user_created
and
user_updated
, but the relations fields is on one collection
User
. I want to sort by
user_created.name
field, but how i can do this ? In Api Reference, i do :
Copy code
{
  "sort_by": "$users(name:desc )"
}
But i want more that :
Copy code
{
  "sort_by": "$users(_eval(id:=user_created.id):name:desc)"
}
Any suggestions ? 🙂
h
Is this what you're trying to achieve?
Copy code
{
  "sort_by": "$users(_eval(id:=user_created.id):desc, name:desc)"
}
f
Yes, it's available ?
Or more like that :
Copy code
{
  "sort_by": "$users(_eval(id:=user_created.id), name:desc)"
}
It's means in SQL
Copy code
SELECT mc.user_created, mc.user_updated, uc.name
FROM MyCollection mc
JOIN userCreated uc ON uc.id === mc.user_created
ORDER BY uc.name DESC
h
Can you share the schema definitions?