<@U9TDEHN92> can’t you just sort by Id and do a re...
# orm-help
a
@Corjen can’t you just sort by Id and do a reverse ?
c
No, I see that the example is not clear enough 🙂
The id's can be a random order, so
["2", "4", "5", "1"]
, etc.
The use case is this:
There is a relation type with every company that has an enum
["WAITING", "LIKED", "DISLIKED"]
What i want is to get a list of companies with no relations first, then with a relation with type
WAITING
, and so one
a
I am not sure if prisma has a feature for this. But I found this on stackoverflow with normal sql: https://stackoverflow.com/questions/41712032/sql-server-select-query-with-in-and-order-by-the-same You can maybe try and recreate that
Maybe loop through that list and query each enum individually. You can then append to list if found and then return the list. Its not that sexy but it would work
c
Yeah, got that working, though pagination is a bit tricky. Was wondering if there isn't a better solution inside prisma
That would be either sorting by relation type, or being able to retreive a list in a certain id order
s
This is really interesting @Corjen. Would you mind opening a GH issue for this as a feature request?
c
Sure!
@schickling https://github.com/prisma/prisma/issues/4223 There you go! Hope it makes sense! 🙂
🙏 1