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!

SQL Logic for using LIKE condition based on column values of another table

Rama0830May 16 2021 — edited May 16 2021

We have a requirement where there are two tables with no keys between them (Master Table and Reference Table)
I have attached the script and also the excel spreadsheet with the expected results.
The Master table has Name and Location columns, Reference table has Category and Type columns.
Master table Location column should check values in Reference table Type column and then give the relevant Category from the Reference table.
For example (from the attachment):-
For John, in the location column, there is Hallway, so it should check-in from the Type column in the Reference table and give output as Hallway, Stairs, Lobby.
I tried different methods with LIKE condition but failed.
Please do suggest if this is achievable or not? and also please do suggest any recommendations.
Thank you so much for your help.
-Rama
Scripts.txt (1.09 KB)Results (1).xlsx (10.68 KB)

This post has been answered by Frank Kulash on May 18 2021
Jump to Answer

Comments

Post Details

Added on May 16 2021
13 comments
427 views