I have 4 tables users, opportunities, level_translations and levels
users
id, name, email
opportunities
id, client_name, user_id, total_price
levels
id, min, max
level_translations
id, name, description, locale, level_id
I want to get level name in current locale for given user id .. i'm using laravel-translatable package to localize my application
to get level it should be something like this
select * from levels where sum(opportunities.total_price) < levels.max and sum(opportunities.total_price) > levels.min