Sorting on the first relationship in an aggregate
I want to do an aggregate over a m2m table where the order is important, so I write the code below but whatever I do I can't seem to sort on the first table. Should I be able to do that?
Solution:Jump to solution
tldr: Calculations ❤️
The solution was to use a calculation on
:some_many_to_one_table
that got the phone number:
```elixir...5 Replies
Solution
tldr: Calculations ❤️
The solution was to use a calculation on
:some_many_to_one_table
that got the phone number:
And then create another calculation on the first resource:
And then I could load everything and produce a super pretty query with the best type annotation.
Yeah I thought we fixed the double type casting but must not have
Oh, does double type casting do anything? Except for making me happy. 🙂
double type casting can have performance impacts where it gets confused about the index to use I think?
Either way it would probably end up as something like:
Got it! It's always the risk of making the query planner confused that makes me worried when interacting with databases.