简体   繁体   English

Sql 查询以检查第 1 列的 substring 是否包含另一列的值

[英]Sql query to check if substring of column 1 contains is value of another column

I have 2 tables column col1 of table1 has values abc, def, ghi我有 2 个表,表 1 的列 col1 有值 abc、def、ghi

The value of the column col2 of the second table contains one of the above values.第二个表的 col2 列的值包含上述值之一。

Now I want the list of all rows of table2 which are the part of the value of col1现在我想要 table2 的所有行的列表,它们是 col1 值的一部分

Please use below syntax to get your data,请使用以下语法获取您的数据,

select t2.* from table1 t1
inner join table2 t2
on (t1.col1 = t2.col2);

Also please tag appropriate tag as well as provide sample data to make every one understand and get proper solution还请标记适当的标签并提供示例数据以使每个人都理解并获得正确的解决方案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM