还是不太明白你的需求,一般这种判断可以使用CASE WHEN...ELSE...END的方法来判断,例如SELECT col1, case when col1 = 1 then 'true' else 'false' end FROM table1我手边没有SQL技术手册,不记得oracle是否支持了,应该是支持的。
StrSQL="select t1.a,t1.e,t2.b,t3.c from A t1,B t2,C t3 where t1.a=t2.a and t2.b=t3.b" rs.open StrSQL,conn,3,1 if not rs.eof then do while not rs.eof If IsNull(rs("b")) = False Then If IsNull(Rs("c")) = True Then x = 2 Else x = 3 End If Else x = 1 End If rs.movenext loop end if rs.close
basically I don't understand what you want , but anyway just try to use below template to generated your dataselect decode(sum(Seed1),0,1,(decode(sum(Seed2),count(*),2,3)) ( select decode(B.b,NULL,0,1) as Seed1 , decode(B.b,NULL,0,1) as Seed2 from A,B,C where A.a = B.a and (B.b = C.b or (B.b is null)) ) T_setSorry that maybe there is some syntax error , but anyway it should not be so difficult to fix this problem
select A.a, decode(sum(decode(B.b,null,0,1)),0,1,decode(sum(decode(C.c,null,1,0)),0,3,2)) x from A,B,C where A.a=B.a and (B.b is null or B.b=C.b) group by A.a
rs.open StrSQL,conn,3,1
if not rs.eof then
do while not rs.eof
If IsNull(rs("b")) = False Then
If IsNull(Rs("c")) = True Then
x = 2
Else
x = 3
End If
Else
x = 1
End If
rs.movenext
loop
end if
rs.close
template to generated your dataselect decode(sum(Seed1),0,1,(decode(sum(Seed2),count(*),2,3))
(
select decode(B.b,NULL,0,1) as Seed1 , decode(B.b,NULL,0,1) as Seed2
from A,B,C
where A.a = B.a
and (B.b = C.b or (B.b is null))
) T_setSorry that maybe there is some syntax error , but anyway it should not be so difficult to fix this problem
from A,B,C
where A.a=B.a and (B.b is null or B.b=C.b)
group by A.a