如:表中字段a,b,ca字段每行都有值,b,c字段只有部分行有值现在我想要a的全部值,b和c的非空值,请问应该怎么样实现呀。

解决方案 »

  1.   

    不太明白  你说的   "现在我想要a的全部值,b和c的非空值"
    select a,b,c from TABLE where b is not null and c is not null
    还是
    select (select a from Table) as a,(select b from TABLE where b is not null) as b ,(select c from TABLE where c is not null) as c
      

  2.   

    在前台显示的时候我想显示:a字段的所有值,b字段不为空的值,c字段不为空的值能用一条sql实现吗
      

  3.   

    select a,B=IsNull(b,0),C=IsNull(c,0) From Table
    由于表Table字段A全部有值,字段B和字段C有可能存在空值,如果想得到A的全部值,只能将该条字段B或字段C为空值的记录设为你自定的一个值。可以是字符或数字。
      

  4.   

    如果我想不显示空的b 和c的值,是不是非得要多条sql?查出b 和 c 的非空值出来
    SQL_01=SELECT DISTINCT B FROM TABLE
    SQL_02=SELECT DISTINCT C FROM TABLE另一条查出a的值出来
    SQL_03=SELECT A FROM TABLE
      

  5.   

    纠正一下我上面的错误如果我想不显示空的b 和c的值,是不是非得要多条sql? 查出b   和   c   的非空值出来 
    SQL_01=SELECT   B   FROM   TABLE WHERE B IS NOT NULL
    SQL_02=SELECT   C   FROM   TABLE WHERE C IS NOT NULL另一条查出a的值出来 
    SQL_03=SELECT   A   FROM   TABLE
      

  6.   

    select   a,b,c   from   TABLE   where   b   is   not   null   and   c   is   not   null 
    这样??
    显示出来的就是   a的全部值,b和c的非空值
      

  7.   

    SELECT a,b,c FROM TABLE where b IS NOT NULL AND c IS NOT NULL
    ok了
      

  8.   

    请大家原谅我的愚钝。
    我想把a中所有纪录显示
    a  b     c 
    1  0     0
    2  null  null
    3  null  1
    4  1     2显示结果:
    b:0,1
    c:0,1,2
    a:1,2,3,4用SELECT   a,b,c   FROM   TABLE   where   b   IS   NOT   NULL   AND   c   IS   NOT   NULL 可以实现吗?
      

  9.   

    SELECT a,b,c  FROM  TABLE  where b IS NOT NULL AND c IS NOT NULL   结果是不是:
    b:0,1
    c:0,2
    a:1,4
      

  10.   

    這不是好簡單嗎
    如果a不管,要b和c都不是空值
    select a,b,c
    from table
    where b is not null
    and c is not null
      

  11.   

    這不是好簡單嗎
    如果a不管,要b和c都不是空值
    select a,b,c
    from table
    where b is not null
    and c is not null
      

  12.   

    這不是好簡單嗎
    如果a不管,要b和c都不是空值
    select a,b,c
    from table
    where b is not null
    and c is not null
      

  13.   

    這不是好簡單嗎
    如果a不管,要b和c都不是空值
    select a,b,c
    from table
    where b is not null
    and c is not null
      

  14.   

    這不是好簡單嗎
    如果a不管,要b和c都不是空值
    select a,b,c
    from table
    where b is not null
    and c is not null
      

  15.   

    這不是好簡單嗎
    如果a不管,要b和c都不是空值
    select a,b,c
    from table
    where b is not null
    and c is not null
      

  16.   

    select   a,b,c   from   TABLE   where   b   is   not   null   and   c   is   not   null 
      这样就可以了
      

  17.   

    请大家原谅我的愚钝。 
    我想把a中所有纪录显示 
    a     b           c   
    1     0           0 
    2     null     null 
    3     null     1 
    4     1           2 显示结果: 
    b:0,1 
    c:0,1,2 
    a:1,2,3,4 
    =================================
    如果是这样要求那只能使用多条语句来实现了。
      

  18.   

    select A.a,isnull(B.b,''),isnull(C.c,'') from A left join select b from A where b is not null B left join select c from A where b is not null C
    试试看这句了。