有两个表,trim的查出tabA在tabB中没有的数据!且不是空tabA
fieldA
1  
2
3

null
空格tabB
fieldB
1
7
3
8
---------------------
结果是2trim的查出tabB在tabA中没有的数据!且不是空
---------------------
结果是7,8

解决方案 »

  1.   

    这不是很简单的
    select a.*
        from taba a
    where not exists
         (
           select 1
           from tabb b
           where trim(a.fieldA)=b.fieldB)
    select b.*
        from tabb b
    where not exists
         (
           select 1
           from taba a
           where trim(b.fieldb)=a.fielda)
      

  2.   

    select fieldA from tabA A where A IS NOT NULL AND TRIM(A.fieldA) != '' AND EXITS (SELECT 1 FROM tabB B WHERE A.fieldA != B.fieldB)令一个参考着写吧
      

  3.   

    select a.*
        from taba a
    where not exists
         (
           select 1
           from tabb b
           where trim(a.fieldA)=trim(b.fieldB)
          )
    是不是这个意思啊?
      

  4.   

    1.
    select trim(a.fieldA)
    from tabA a
    minus
    select b.fieldB
    from tableB B
    2.
    select a.fieldA
    from tabA a
    minus
    select trim(b.fieldB)
    from tableB B可以么?
      

  5.   

    不行两个小时都没有结果啊?怎么能吧结果直接到入一个文件啊?
    sql是否有这样的命令啊?
      

  6.   

    SQL codeselecttrim(a.fieldA)fromtabA a 
    minusselectb.fieldBfromtableB B 
    2. 
    SQL codeselecta.fieldAfromtabA a 
    minusselecttrim(b.fieldB)fromtableB B 
    效率高写吧