不太明白 你说的 "现在我想要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
在前台显示的时候我想显示:a字段的所有值,b字段不为空的值,c字段不为空的值能用一条sql实现吗
select a,B=IsNull(b,0),C=IsNull(c,0) From Table 由于表Table字段A全部有值,字段B和字段C有可能存在空值,如果想得到A的全部值,只能将该条字段B或字段C为空值的记录设为你自定的一个值。可以是字符或数字。
如果我想不显示空的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
纠正一下我上面的错误如果我想不显示空的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
select a,b,c from TABLE where b is not null and c is not null 这样?? 显示出来的就是 a的全部值,b和c的非空值
SELECT a,b,c FROM TABLE where b IS NOT NULL AND c IS NOT NULL ok了
请大家原谅我的愚钝。 我想把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 可以实现吗?
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
這不是好簡單嗎 如果a不管,要b和c都不是空值 select a,b,c from table where b is not null and c is not null
這不是好簡單嗎 如果a不管,要b和c都不是空值 select a,b,c from table where b is not null and c is not null
這不是好簡單嗎 如果a不管,要b和c都不是空值 select a,b,c from table where b is not null and c is not null
這不是好簡單嗎 如果a不管,要b和c都不是空值 select a,b,c from table where b is not null and c is not null
這不是好簡單嗎 如果a不管,要b和c都不是空值 select a,b,c from table where b is not null and c is not null
這不是好簡單嗎 如果a不管,要b和c都不是空值 select a,b,c from table where b is not null and c is not null
select a,b,c from TABLE where b is not null and c is not null 这样就可以了
请大家原谅我的愚钝。 我想把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.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 试试看这句了。
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
由于表Table字段A全部有值,字段B和字段C有可能存在空值,如果想得到A的全部值,只能将该条字段B或字段C为空值的记录设为你自定的一个值。可以是字符或数字。
SQL_01=SELECT DISTINCT B FROM TABLE
SQL_02=SELECT DISTINCT C FROM TABLE另一条查出a的值出来
SQL_03=SELECT A FROM TABLE
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
这样??
显示出来的就是 a的全部值,b和c的非空值
ok了
我想把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 可以实现吗?
b:0,1
c:0,2
a:1,4
如果a不管,要b和c都不是空值
select a,b,c
from table
where b is not null
and c is not null
如果a不管,要b和c都不是空值
select a,b,c
from table
where b is not null
and c is not null
如果a不管,要b和c都不是空值
select a,b,c
from table
where b is not null
and c is not null
如果a不管,要b和c都不是空值
select a,b,c
from table
where b is not null
and c is not null
如果a不管,要b和c都不是空值
select a,b,c
from table
where b is not null
and c is not null
如果a不管,要b和c都不是空值
select a,b,c
from table
where b is not null
and c is not null
这样就可以了
我想把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
=================================
如果是这样要求那只能使用多条语句来实现了。
试试看这句了。