with cte_1 as ( select F.id, F.friend_id as Friend_new, R.rating as rating_1, R2.rating as rating_2 from friends F left join rating R on F.id = R.id left join rating R2 on F.friend_id = R2.id order by F.id) select id from( select case when rating_1 > rating_2 or (Friend_new is null and rating_1 >85) then id end as id from cte_1) where id is not null
Thankyou for the providing the solution.
thankyou for this playlist
Great playlist....keep it upp❤ 🔥
Thankful to you for providing this playlist .
with cte_1 as (
select F.id, F.friend_id as Friend_new, R.rating as rating_1, R2.rating as rating_2
from friends F left join rating R on F.id = R.id left join rating R2 on F.friend_id = R2.id
order by F.id)
select id
from(
select case when rating_1 > rating_2 or (Friend_new is null and rating_1 >85) then id end as id
from cte_1)
where id is not null