How can I structure this 'within x radius' search logic?

I would like both unlogged in and logged in users to be able to run a search which returns which businesses in the database deliver to their address.

Businesses have entered their address into the db and stated how far from their address they are willing to do delivery.

Subsequently, a customer could have 2 businesses that are both 10km away from them however, only 1 business will deliver to them as their radius for delivery is 20km and the other business will not deliver as their radius for delivery is only 5 km.

How will the pink customer return only the blue businesses in their results?

delivery

I just read a similar solution on this thread. It dealt with sorting, but maybe the logic can help your search.
Post number 14.

Thanks I’ll read through that. At the moment I’m struggling to even understand what the actual calculation would be.

No sooner had I written that, it came to me that it would be ‘the distance between customer and business is less than or equal to the business’ max delivery radius. ’

Now I just have to get it calculated somehow.

Hi. I’m just searching for a very similar solution. Did you every sort out your conditional search logic constraint?
I’ve managed to create the logic to search for results within a predefined distance but not the ‘the distance between customer and business is less than or equal to the business’ max delivery radius. ’ part.