Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Get data from table 1 if exist, else get from table 2

DannyS-OracleJan 19 2018 — edited Jan 20 2018

Hi everyone, I am a beginner in terms of SQL development, please be kind to me

I am building a tagging system for my application. The first table is storing the tags assigned by my team (human reviewer), while the second table is storing the tags assigned automatically by my application (by scanning the text during data import). Here are the two tables to illustrate:

Table 1. Human-reviewer Tags

ID_RECORDTAG
1hello
2world

Table 2. Machine-assisted Tags

ID_RECORDTAG
1helo
2wor
3foo

On the reporting side, I want to display all records, with each record displays Human-reviewer tags if it exist. If the record has not been reviewed by the human, it will take the tags from the Machine-assisted tags (because it is guaranteed that all records are automatically assigned tags by the tool, but my team need longer time to review and assign tags to the records).

How can I achieve this with SQL? I am using OracleDB v12.

Thank you in advance

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 17 2018
Added on Jan 19 2018
4 comments
2,417 views