>>>>Hi everybody,
>>>>
>>>>I am struggling to create one SQL select that will create a query as following (simplified):
>>>>
>>>>
>>>>1. table mytable1 has the following records:
>>>>
>>>>PK_VAL
>>>>1
>>>>2
>>>>3
>>>>
>>>>2. table mytable2 has the following records:
>>>>PK_VAL
>>>>1
>>>>2
>>>>5
>>>>6
>>>>
>>>>
>>>>I want to create a query of all records in mytable1 plus records in mytable2 that have PKs missing in mytable1. In the example above, the resulting query would have the following records:
>>>>
>>>>PK_VAL
>>>>1 (from mytable1)
>>>>2 (from mytable1)
>>>>3 (from mytable1)
>>>>5 (from mytable2)
>>>>6 (from mytable2).
>>>>
>>>>
>>>>Thank you in advance for any help.
>>>
>>>select nvl(MyTble1.PK,myTble2.PK) as PK from myTable1
>>>right join myTable2 on myTable1.PK = myTable2.PK
>>
>>Thank you. I will give it a try.
>
>Or you can switch table 2 and 1 and use a left join. E.g. select
>
>nvl(myTable1.PK, myTable2.PK) as PK from myTable2 left join myTable1 ...
>
>You can also always use FULL OUTER JOIN.
Thank you, again.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham