Skip to content
Advertisement

How add more rows when find string in column Oracle

Would it be possible to add more rows base on Keyword string in SQL ?

table A

table B

Example:

Output of the SQL should be –

How to find string with keyword ‘FamilyCare’ in PromotionName of table A base on promotion_code of table B? If it exist it will add more rows in output

Any help with the SQL?

Advertisement

Answer

Here is how you can achieve this:

You have to update your pid in both the places (before and after UNION).

Notice that tables were joined using LIKE operator with % before and after the word. Hence this joins if a part of a string is present in another column.

db<>fiddle link here

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement