我有一个表com_customer_mst,它包含customer_id及其parent_customer_id,我需要获取特定customer_id的所有父项和子项作为输入。一个customer_id将有一个父母,但可能有多个孩子。
我已经运行了这个查询:
SELECT CUSTOMER_ID, customer_code, PARENT_CUSTOMER_ID FROM SBSA_AXIA.COM_CUSTOMER_MST
start with customer_id = 154
connect by prior CUSTOMER_ID = PARENT_CUSTOMER_ID;
但它只给所有孩子。
customer_id PARENT_CUSTOMER_ID
61 12
18 12
111 12
250 12
14 15