Re: Is the selection possible?
Posted in 1997
select T1.a, T2.b2
from T2, T1
where b2 is not null
and T1.a = T2.a
union
select T1.a, T3.b3
from T2, T1, T3
where b2 is null
and T1.a = T2.a
and T3.a = T2.a
Mike.
In article <5vk0ik$n5g$1@cssun.mathcs.emory.edu>, Yan Liu
<yan@mathcs.emory.edu> writes
> We have 3 tables, T1, T2, T3.
>T1 has fields a, b1.
>T2 has fields a, b2.
>T3 has fields a, b3.
>
>If b2 is not NULL, I need select T1.a, T2.b2 into $a, $b
> from T1, T2
> where T1.a=T2.a
> ORDER by T2.b2
>
>Otherwise , I need select T1.a, T3.b3 into $a, $b
> from T1, T3
> where T1.a=T3.a
> ORDER by T3.b3
>
>Is there any way I can do ONE query and get $a and $b?
>
>Thanx.
>
>
>--
>Yan Liu
>Anesthesia Computer Service at Emory University Hospital, Atlanta, GA
--
Mik Hobbs