Re: Is the selection possible?
Posted in 1997
You can do a query union, like:
SELECT T1.a, T2.b2 INTO $a, $b
FROM T1, T2
WHERE T1.a=T2.a and T2.b2 is not null
UNION
SELECT T1.a, T3.b3
FROM T1, T3, T2
WHERE T1.a=T3.a
AND T1.a=T2.a
AND T2.b2 is null
ORDER by 2
HTH
Weimin Yang
______________________________ Reply Separator _________________________________
Subject: Is the selection possible?
Author: yan@mathcs.emory.edu (Yan Liu) at INTERNET
Date: 9/15/97 7:35 PM
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