I have 2 sql's and want to know how to combine.
SQLS simplied:
SQL1 =
select A.number, B.sn
from A, B
where A.id = B.id
and B.typecd =' O'
SQL1 returns for example
A.number = 12345Z
B.sn = 2222
SQL2 =
select B.name, A.dob, A.sn
from A, B
where A.id = B.id
and B.typecd = 'P'
and A.number = '12345Z'
and B.sn = '2222'
How can these 2 SQLs be combined to return results for SQL2?
Currently I run SQL1 and take those results and plug into SQL2. Currently OK but could be better?
Thanks!