請問一下是否有人知道如何輸入一個「主料料號」可以把後續的尾階一並展出
使用SQL
目前我只會展出全部的「上階料號、元件料號」,不知如何把「主件料號」顯示出來
SELECT
bmb01 上階料號,
bmb03 元件料號
FROM
(
SELECT
bmb01,bmb02,bmb03,(bmb06/NVL(bmb07,1)) bmb06,LEVEL numnn
FROM bmb_file
START WITH bmb01 ='ABC'
AND (bmb04 <=SYSDATE OR bmb04 IS NULL)
AND (bmb05 > SYSDATE OR bmb05 IS NULL)
CONNECT BY PRIOR bmb03 = bmb01 AND (bmb04 <=SYSDATE OR bmb04 IS NULL) AND (bmb05 > SYSDATE OR bmb05 IS NULL)
ORDER BY LEVEL,bmb01
) a