Query to return the value in same column from two different tables
Hi All - I had the following scenario & i need the inputs from you.
There are two tables say xx1 and xx2 which has the same column names as id,name
Scenario1:
xx1 has the data like --No records
xx2 has the data like --1,xyz
select NVL(xx1.name,xx2.name) name from xx1,xx2 where xx2.id(+)=xx1.id --This gives me xyz
Scenario2:
xx1 has the data like --1,
xx2 has the data like --1,xyz
select NVL(xx1.name,xx2.name) name from xx1,xx2 where xx2.id(+)=xx1.id --This gives me xyz
In this scenario,as the data is available in both the tables.Even the name in xx1 table is null.I want that value from xx1 instead of xyz.
If xx1 & xx2 has the records for the same id ,then the name should come from xx1.Even though the name is null i have to get the value as null.
Based on the above two scenarios,i have to store the value in the same column .
Edited by: user11164339 on Jul 30, 2012 3:44 PM