簡體   English   中英

SQL:將一列的字符串與另一張表的子字符串匹配

[英]SQL : matching string of one column to substring of another table column

我有兩個表t1和t3。 如果t2字符串中存在t1字符串,則我需要t3包含t1字符串。

t1-[mango, apple, Top]
t2-[{Ate mango}, {it was nice apple},{you are hero}, {apple shares top}] 

如果t1的字符串與t2的子字符串匹配,則t3將輸出為t3

t3-[mango, apple, , {apple,top}]

在此處輸入圖片說明

Select
SecondCol Result
From
(
Select
Col2 FirstCol, 
UPPER(LISTAGG(Col1, ', ') WITHIN GROUP (ORDER BY Col2)) SecondCol
From
(Select Table1.T1 Col1, Table2.T1 Col2 From Table1,Table2
Where
Length(REGEXP_SUBSTR(UPPER(Table2.T1), UPPER(Table1.T1)))<>0
)
Group By Col2
);

執行上述查詢后的屏幕截圖

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM