表1的col1和表2的col2都是16个字符的编码,col1中有100行数据,col2中有200行数据(其中100行和col1是相同的),怎么把col2中另100行数据挑出来。
就是把col2中和col1不同的值挑出来

解决方案 »

  1.   

    select * from t  where col1<>col2???
      

  2.   

    这 更简单了,select col2
      from t2
    minus
    select col1 from t1
      

  3.   

    表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)
      

  4.   

    select * from 表2 where col2 not in(select col1 from 表1 where 表1.col1=表2.col2);
      

  5.   

    同意此方法
    我不同意这个方法。如果表1,2里面有null的话,查不出来
      

  6.   

    同意此方法
    我不同意这个方法。如果表1,2里面有null的话,查不出来表2.col2 is null 与 表1.col1  is null 不算相同吧