表1的col1和表2的col2都是16个字符的编码,col1中有100行数据,col2中有200行数据(其中100行和col1是相同的),怎么把col2中另100行数据挑出来。
就是把col2中和col1不同的值挑出来
------解决方案--------------------
看成了一个表了。。
2个表 是否有关联字段可关联??
------解决方案--------------------
这 更简单了,
select col2
from t2
minus
select col1 from t1
------解决方案--------------------
表1的col1和表2的col2都是16个字符的编码,col1中有100行数据,col2中有200行数据(其中100行和col1是相同的),怎么把col2中另100行数据挑出来。
100~200行数据,就不考虑效率了
select * from 表2 where col2 not in(select col1 from 表1)
------解决方案--------------------
select * from 表2 where col2 not in(select col1 from 表1 where 表1.col1=表2.col2);
------解决方案--------------------
表2.col2 is null 与 表1.col1 is null 不算相同吧