I had an below table
(我有一张桌子)
y TABLE
(表)
id val
-- ---
1 A
1 B
1 C
2 B
2 C
3 A
Need output like below
(需要如下输出)
sno val1 va2 val3
----- ---- ----- ------
1 A B C
2 B C -
3 A - -
I wrote query with self join like
(我写了像自我加入查询)
SELECT t1.id as sno, t1.val as val1, t2.val as va2, t3.val as val3
FROM y t1 JOIN y t2 ON t1.id = t2.id
JOIN y t3 ON t2.id = t3.id
ORDER BY 1,2,3,4;
But i returns like Cartesian join.
(但是我回来就像笛卡尔加入。)
How to get proper result. (如何获得适当的结果。)
ask by Naveen M translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…