select *
from (
select x.*,
row_number()
over (partition by movie_id order by case when domain_id = '2' then 0 else 1 end, domain_id desc) as rn_domain
from (
select movie_desc.*,
row_number()
over (partition by movie_id, domain_id order by case when language_id = '1' then 0 else 1 end, language_id desc) as rn_lang
from movie_desc
) x
) t
where t.rn_domain = 1
and t.rn_lang = 1;
function maFunc(){
let res = 0;
$(blocks).each(function() {
if (iWantToBreak) {
res++;
};
});
if (res > 0) {
return false;
};
}