Ordering results based on a calculated/grouped field (e.g. sum) - possible?

Hey all,

So I’m building a ‘dashboard’ where I want to display top service providers to the user, and I want to order service providers based on total amount ‘spent’ with them.

I’ve been able to group the results using the group option in a repeating group, but for the life of me I can’t find a way to order the results based on the total amount spent with them.

The DB structure - the service provider is linked to a DB Thing that creates single transactions - this is what I’m creating a ‘sum’ on, and this transaction thing has both the buyer / seller linked.

Any advice or ideas appreciated

Matt

This might help.

You can follow the logic path if you want throughout the thread, or just jump right to the end for the link to @gaurav’s slick solution.

2 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.