with cte as (
select * from ReverseNumbers where a+b in (select * from (Select a+b from ReverseNumbers group by 1 having count(*)=1)x))
select * from reverseNumbers where a
my solution:
select distinct least(A,B) as A , greatest(A,B) as B from reversenumbers
One doubt how come [6,2] is also in output ,since it is not a reversed pair as per input.
Below is my Solution. I have used both A*B and A+B, to deal with condition like (2,4),(4,2),(1,8),(8,1)
With cte as (
Select A,B, A*B as [Product], A+B as [Sum]
,ROW_NUMBER() Over(partition by A*B, A+B order by A) as rn
from ReverseNumbers
)
Select A,B
from cte
Where rn = 1;
Sorry everyone for the low voice. This is one of my earliest videos, so i was learning how to record, edit and make videos. Hope you understand 🙂