Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need to query to fetch only the Hierarchies based on Item availability

BommiMay 13 2025 — edited May 13 2025

Hi Experts,

Please note, this is related to Oracle cloud, but I hope I can post this here as it is related to creation of sql query.

We have a table which has data of Hierarchy details table as below (please note it actually a query which is on Dimension Tables)

And we have also another table which has NPI Items table as below(This is also not a simple table query, but based on multiple table joinings if NPI Items are defined)

Now, first table query has to be modified in a way that it should show only the details which has items in second NPI Items query.

Example: ‘D313025GX03 - GDRV’ is item which is available in first Hierarchy Details table and also in NPI Items table. So, first 3 records has to be shown in output. As ‘ABC Item’ is not available in NPI Items table, the next 3 records should not be shown in Hierarchy Details table. So, final report has to be shown in below way.

Can anyone please help me on how to achieve this.

Thanks in Advance,
Bommi

Comments
Post Details
Added on May 13 2025
6 comments
350 views