【Teradata SQL】數據庫中查詢 一個字段包含另一個字段sql


1.目標

數據庫中查詢一個字段包含另一個字段,返回包含的記錄。

select * from table  a  where 字段1 like '%'||字段2||'%' 

2.示例

create multiset table regexp_test (
col1 varchar(100)
,col2 varchar(100)
)no primary index;

insert into regexp_test values('T01','T01_PDM0001');
insert into regexp_test values('T02','T01_PDM0001');
insert into regexp_test values('T03','T03_PDM0001');

sel * from regexp_test where col2 like '%'||col1||'%';

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM