How find the Thing with most links/relations to another Thing

I have two tables. One with Competitors and one with Voters. Voters have a reference to the Competitor they voted for. I need to find the Competitor with the most Votes. Not a db expert, so can’t seem to crack this :blush:

Honestly, it would be easier to keep a number field on the Competitor. Every time a new voter votes, make a change to Competitor > votes field = this Competitor’s votes field + 1

Yes, but it requires me to keep track of when and where the counters should be changed (more than one place), which is a bug inducing risk. Is this Do Search possible in Bubble?

@romanmg is right, that will be the easiest way.

You could probably fudge something together with a temporary table and api workflows… But that will be slower and probably more complicated.

Ok. Temp tables sound error prone. Counter it is. Thanks.

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