我正在为下表
Classification_Product
和Order_details
表格进行 oracle 分层查询
分类产品有Classification_id
哪些将Order_details
根据用户选择存储在
我想从具有父级的Order_details
表中选择所有产品,无论孩子是 32 英寸或 50 英寸还是索尼三星等LED Screen
,都将返回所有具有父级的产品LED Screen
我尝试使用下面的查询,但它的 replate 行很多
SELECT B.CLASSIFICATION_ID, LEVEL AS VLEVEL, A.CATEGORY_ID, A.CATEGORY_DESC, CONNECT_BY_ISLEAF AS leaf
FROM PRODUCT_CLASSIFICATION A, ORDER_DETAILS B
WHERE A.STATUS = 1 and b.created_on like sysdate--AND leaf =1
START WITH A.CATEGORY_ID IS NULL
CONNECT BY A.CATEGORY_ID = PRIOR A.CLASSIFICATION_ID
ORDER SIBLINGS BY A.CLASSIFICATION_ID;