クエリがあります。次のテーブル間に以下の関係があります
select * from PRODGP_STRUCTURE
select * from PRODGP_STR_LINK
select * from PRODUCT_GROUP
select * from PROD_PGRP_LINK
select * from PRODUCT
関係は...
select pstr.PSTR_NAME, PG.PRGP_NAME, PRD.PROD_NAME
from prodgp_structure pstr
JOIN PRODGP_STR_LINK pgstrlnk
ON pgstrlnk.PSTR_ID = pstr.PSTR_ID
JOIN PRODUCT_GROUP pg
ON pgstrlnk.PRGP_CHILD_ID = PG.PRGP_ID
JOIN PROD_PGRP_LINK prdprdgp
ON prdprdgp.PRGP_ID = pg.PRGP_ID
JOIN product prd
ON prdprdgp.PROD_ID = prd.PROD_ID;
次のクエリにたどり着きました、
select * from PRODGP_STRUCTURE where pstr_id in
(select pstr_id from PRODGP_STR_LINK where PRGP_CHILD_ID in
(select prgp_id from PRODUCT_GROUP where PRGP_ID in ( select PRGP_ID from PROD_PGRP_LINK where PROD_ID in ( select PROD_ID from product where PROD_ID=2))))
このクエリを書く他の方法があることを知らせてください..!!