I can see how that would work.
It still seems like a lot of operations.
If this is an infrequent or even marginally frequent query it shold probably be ok. If not you might look at my original suggestion.. A lot depends (in my mind) on how often this kind of comparison is done.
CEWII