trySelect * From 表 Where a In
(Select a From
(Select a, b As Value From 表
Union All
Select a, c As Value From 表
Union All
Select a, d As Value From 表
Union All
Select a, e As Value From 表
Union All
Select a, f As Value From 表
Union All
Select a, g As Value From 表) A
Group By a Having Count(Distinct value) > 1)

解决方案 »

  1.   

    加上判斷
    Select * From 表 Where a In
    (Select a From
    (Select a, b As Value From 表
    Union All
    Select a, c As Value From 表
    Union All
    Select a, d As Value From 表
    Union All
    Select a, e As Value From 表
    Union All
    Select a, f As Value From 表
    Union All
    Select a, g As Value From 表) A
    Where Value Is Not Null
    Group By a Having Count(Distinct value) > 1)
      

  2.   

    select * from 表名 where (not (b=c and c=d and d=e and e=f and f=g)) and b<>null and c<>null and d<>null and e<>null and f<>null and g<>null这是暂时做法吧,试一下吧。有好的方法再说。暂时没想到。
      

  3.   

    select * from 表名 where (not (b=c and c=d and d=e and e=f and f=g)) and b<>null and c<>null and d<>null and e<>null and f<>null and g<>null-----------
    同意
      

  4.   

    为什么我的值明明是相同的,还列出?
    是字段类型的问题?
    是varchar不行吗?好像必须是varchar啊,因为不仅仅有数字,还有数字与字母的组合
      

  5.   

    fa_ge(鶴嘯九天),你怎麼亂同意?!g<>null這種寫法OK嗎?
      

  6.   

    yowbell(出色的女人从鸡做起,优秀的男人从狗做起) ( ) 信誉:100  2007-08-18 11:15:18  得分: 0  
     
     
       为什么我的值明明是相同的,还列出?
    是字段类型的问题?
    是varchar不行吗?好像必须是varchar啊,因为不仅仅有数字,还有数字与字母的组合
      
     
    ------------
    哪個語句?
      

  7.   

    楼上老大,可以查询出结果
    但是如下这种样式:
    a      b       c     d     e     f      g 
    -------------------------------------------
    001 04008   04008          04008按我的要求这样的结果是不应该显示出来的啊
    注明b-g字段类型是varchar(8000)这个类型是不能变的,老大帮我看看是哪里问题?
      

  8.   

    paoluo(一天到晚游泳的鱼(學習.NET中)) ( ) 信誉:100  2007-08-18 11:24:41  得分: 0  
     
     
       fa_ge(鶴嘯九天),你怎麼亂同意?!g<>null這種寫法OK嗎?
      
     
    ----------------
    應該 isnull(g,'')<>''
    哈哈恭喜魚兄升星了
      

  9.   

    都正确吧Select * From TB Where (B<>C OR C<>D OR D<>E OR E<>F OR F<>G) 
    AND isNull(A,'')<>'' and isNull(B,'')<>'' and isNull(C,'')<>'' and isNull(D,'')<>'' 
    and isNull(E,'')<>'' and isNull(F,'')<>'' and isNull(G,'')<>''
      

  10.   

    你的空是指Null還是''trySelect * From 表 Where a In
    (Select a From
    (Select a, b As Value From 表
    Union All
    Select a, c As Value From 表
    Union All
    Select a, d As Value From 表
    Union All
    Select a, e As Value From 表
    Union All
    Select a, f As Value From 表
    Union All
    Select a, g As Value From 表) A
    Where IsNull(Value, '') != ''
    Group By a Having Count(Distinct value) > 1)
      

  11.   

    老大们顺便看一下这个?http://community.csdn.net/Expert/topic/5716/5716251.xml?temp=.9078638
    顺便也放分,只是分太少,别介意啊