Hello. Tell me, please, how best to join 2 tables:
Cars
- mark
- power
Car categories
- name of category
- min_power
As a result, should be selected:
- brand
- name of category
Selection under the condition that power> = min_power in categories. Everything is complicated by the fact that if power = 150, then the category should be the one where min_power = 120 (but under the condition> = 150 several categories fall). Plus, maybe the power is less than the minimum power in the categories and you need to return an empty string or zero.
Theoretically, there are not so many rows and you can make a subquery for each row, but it seems to me that this is not really ice at all.