I have got a query like
select distinct rel.service_code, gsm.mobile_no
from service.gsm gsm, service.gsm_relation rel
where gsm.code = rel.child_service_code(+)
which outputs results like
service code GSM
(null) 08864124323
null 05534234234
null 03244242423
5000552 02443244324
(null) 01313131313
(null) 01233131231
Now how can I use the outputted service code, in this case 5000552 to look up in the gsm table like
select mobile_no from service.gsm
where code = '5000552'
which outputs 0773442342 and put this number in the query above instead of the service code. So the desired output in this instance would be
service code GSM
(null) 08864124323
null 05534234234
null 03244242423
0773442342 02443244324
(null) 01313131313
(null) 01233131231
In other words I want to combine these two query into one and get the final result above. So instead of displaying the service code, display the corresponding number to it.