是不是这个意思:select * from tb2 where song_n not in(select song_n from tb1)
select * from table2 where exists (select * from table1 where table1.song_n=table2.song_n)
1、tb2中的song_n不包含在tb1中的select * from tb2 where song_n not in (select song_n from tb1)或者select * from tb2 a where not exists(select 1 from tb1 b where a.song_n=b.song_n ) 2、tb2中的song_n包含在tb1中的select * from tb2 where song_n in (select song_n from tb1)或者select * from tb2 a where exists(select 1 from tb1 b where a.song_n=b.song_n )
select * from tb2 where song_n not in(select song_n from tb1) 这个语句只能搜索查询到 table2中的song_n是不是在table1中, 但是: 或者是不是部分包含在table.song_n中 这个功能没有实现!
2、tb2中的song_n包含在tb1中的select * from tb2 where song_n in (select song_n from tb1)或者select * from tb2 a where exists(select 1 from tb1 b where a.song_n=b.song_n )
这个语句只能搜索查询到
table2中的song_n是不是在table1中, 但是:
或者是不是部分包含在table.song_n中 这个功能没有实现!
随便举例比如:tb2.song_n = 123
tb1.song_n=456212363
我现在用什么语句来查询tb2的song_n中的结果是不是包含与tb1的song_n中!