with cte as( select s1.x as s1x,s1.y as s1y,s2.x as s2x,s2.y as s2y,case when s1.x=s2.y and s2.x=s1.y then 1 end as con from Symmetric_Pair as s1 join Symmetric_Pair as s2 on 1=1) select distinct s1x as x ,s1y as y from cte where con=1 and s1x
with cte as( select Symmetric_Pair.*,ROW_NUMBER()OVER(ORDER BY X) as x1 FROM Symmetric_Pair ),cte1 as( select Symmetric_Pair.*,ROW_NUMBER()OVER(ORDER BY X) as x2 FROM Symmetric_Pair ) select cte.X,cte.Y FROM cte JOIN cte1 ON cte.X=cte1.Y AND cte.Y=cte1.X and x1
with cte as(
select s1.x as s1x,s1.y as s1y,s2.x as s2x,s2.y as s2y,case when s1.x=s2.y and s2.x=s1.y then 1 end as con from Symmetric_Pair as s1 join Symmetric_Pair as s2 on 1=1)
select distinct s1x as x ,s1y as y from cte where con=1 and s1x
awesome bro...1 qk suggestion. Pls flash the expected output before starting to write queries. That will be helpful...
Noted, thanks for your feedback. Keep learning 👍
I am just start to learn SQL but i subscribe your channel in future understanding
That's great to hear that. We are also planning to launch a course on RUclips for 'SQL FROM ZERO TO HERO'.
WITH CTE AS
(SELECT *,CASE WHEN X< Y THEN X ELSE Y END AS x1,
CASE WHEN X
10-Oct-2024
with cte as(
select Symmetric_Pair.*,ROW_NUMBER()OVER(ORDER BY X) as x1 FROM Symmetric_Pair
),cte1 as(
select Symmetric_Pair.*,ROW_NUMBER()OVER(ORDER BY X) as x2 FROM Symmetric_Pair
)
select cte.X,cte.Y FROM cte JOIN cte1 ON cte.X=cte1.Y AND cte.Y=cte1.X and x1