select isnull(A,0.00),isnull(B,1) from C where X=1 if @@rowcount=0 select 0.01 A, 1 B或者select isnull(A,0.00),isnull(B,1) from (select A,B,X from C union all select null A,null B,null X) T1 where t1.X=1 or (t1.A is null and t1.B is null and t1.X is null and not exists (select * from C where C.X=1))
if @@rowcount=0
select 0.01 A, 1 B或者select isnull(A,0.00),isnull(B,1) from
(select A,B,X from C union all select null A,null B,null X) T1
where t1.X=1
or (t1.A is null and t1.B is null and t1.X is null
and not exists (select * from C where C.X=1))