1
是否有可能爲表中的許多行生成「連接方式」並將它們總和。 我有一個表SQL連接多行
person boss
---------------
person1 NULL
person2 person1
person3 person2
,我想拿到桌子
boss is_boss_of
---------------
person1 person2
person1 person3
person2 person3
我想就通過表達給大家表的人,老闆連接? 有什麼辦法可以做到嗎?
俗話講總和我想過這樣的事情
SELECT CONNECT_BY_ROOT person as boss, person as is_boss_of
FROM table1
START WITH boss = person1
CONNECT BY PRIOR Empno = Mgr;
Union
SELECT CONNECT_BY_ROOT person as boss, person as is_boss_of
FROM table1
START WITH boss = person2
CONNECT BY PRIOR Empno = Mgr;
Union
...
and so on
很難理解你想要什麼。你真的認爲那裏有一排p1 p3嗎?你想要總結一些東西嗎? – Randy 2011-02-03 18:44:12