现有表table1和表table2,表结构如图
table1: table2:

现在的目的是从table1中查询出所有stus值为0,而且对应fid的值包含在table2的fids字段的值里的所有记录。
实现的sql语句如下:
select * from table1
where exists(
select fid from table2
where stus='0'
and table2.fids like'%' || table1.fid || '%')
查询的结果如下

本文介绍了如何通过SQL语句从表table1中查询出所有status为0且fid包含在table2的fids字段内的记录。





