select DISTINCT * from 表

解决方案 »

  1.   

    上面的笨蛋:
    select DISTINCT A from 表
      

  2.   

    你才苯呢!
    select distinct  A  from 表 group by A,B having count(*)>1
      

  3.   

    declare @a table (a varchar(100),b int)
    insert @a values('a',1)
    insert @a values('a',0)
    insert @a values('b',1)
    insert @a values('b',1)
    insert @a values('c',1)
    insert @a values('c',1)select distinct  A  from @a group by A,B having count(*)>1
      

  4.   

    A    B
    a    1
    a    0
    a    1
    a    1
    b    1
    b    1
    b    1
    c    1
    c    1
    c    1
    --------------
    我要得到  b与c 阿
      

  5.   

    declare @a table (a varchar(100),b int)
    insert @a values('a',1)
    insert @a values('a',0)
    insert @a values('a',1)
    insert @a values('b',1)
    insert @a values('b',1)
    insert @a values('c',1)
    insert @a values('c',1)select a from (select *  from @a group by A,B) tem group by a having count(a)<2
      

  6.   

    我要distinct A 且 B得值全部为1,若B中有0的话,就不用DISTINCT
      

  7.   

    select a from
    (
    select a, count(a) as co from
    (select a,b from T group by a, b) as t
    group by a
    ) as t2
    where co=1
      

  8.   

    select distinct a from table3 where not a in 
    (select a from table3 where b=0)
      

  9.   

    pengdali(大力):
    不能用这种阿,我在vb里
      

  10.   

    在哪里都没关系
    这只是SQL语句
      

  11.   

    select distinct a from table3 where a in 
    (select a from table3 where a=1)
      

  12.   

    sorry:select distinct a from table3 where a in 
    (select a from table3 where b=1)
      

  13.   

    不对,不对,还是前面那个:select distinct a from table3 where not a in 
    (select a from table3 where b=0)
      

  14.   

    哈!那更简单了!declare @a table (a varchar(100),b int)
    insert @a values('a',1)
    insert @a values('a',0)
    insert @a values('a',1)
    insert @a values('b',0)
    insert @a values('b',0)
    insert @a values('c',1)
    insert @a values('c',1)select distinct  a from @a where a not in (select a from @a where b=0)
      

  15.   

    回复人:pongdali(大力) () 信誉:100  2003-1-30 11:05:51 得分: 20 删除  
      回复人:pengdali(大力) () 信誉:376  2003-1-30 11:06:34 得分: 30 删除  
      回复人:huxin1012(fox) () 信誉:100  2003-1-30 11:35:20 得分: 30 删除  
      回复人:CABO(白椒腊肉) () 信誉:110  2003-1-30 11:27:32 得分: 20 删除  
    我保证我给过了,不过我看不见,只能在管理中看见