Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4382324
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:45:53+00:00 2026-05-21T12:45:53+00:00

So I have 2 tables. Employee and Draft_Employee . They are identical, except that

  • 0

So I have 2 tables. Employee and Draft_Employee. They are identical, except that properties in Draft_Employee allow nulls.

The reason for the 2 identical tables, is that the draft_Employee is a table used for an import procedure – it is a tempoary container. We don’t want the data messed up with the production employees.

Now, when a employee has to be imported, the system has to check if the employee already exists in the database.

First it see’s if it can find an employee in Employee table with the same EmpID.
If found, it will look at employee in Draft_Employee and find the properties which are NULL or EMPTY. It will then take the value for the same field in Employee table and put it into the empty or NULL fields in draft_Employee

empID   name   something1   something2   |   empID    name    something1   something2
-----   ----   ----------   ----------   |   ----     ----    ----------   -----------
1       Casper  blahblah    blahblah2    |   2        Michael NULL         text2fs
2       Michael txttxt                   |

Right is Employee and left is Draft_Employee.

I want an sql query that produces

empID   name     something1   something2
-----   ----     ----------   ----------
2       Michael  txttxt       text2fs

The closest I have come, is with LEFT OUTER JOIN but it gives me data from both tables

EDIT: My query. I did not use it before, because the spelling is danish.

SELECT * FROM Kladde_Ressource
LEFT OUTER JOIN Ressource
ON Ressource.RessourceID = Kladde_Ressource.RessourceID
WHERE Kladde_Ressource.EAN = ''
OR Kladde_Ressource.navnLang = ''
OR Kladde_Ressource.navnKort = ''
etc...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T12:45:54+00:00Added an answer on May 21, 2026 at 12:45 pm

    I don’t entirely grasp your requirement so I am basing my query on the data and required result you’ve posted.

    As to get the results merged into one result set

    • use COALESCE to get the first non-NULL value from both tables.
    • use an INNER JOIN to remove the non-matching rows.

    Statement

    SELECT  e.empID
            , COALESCE(e.name, de.name) AS name
            , COALESCE(e.something1, de.something1) AS something1
            , COALESCE(e.something2, de.something2) AS something2
    FROM    employee e
            INNER JOIN draft_employee de ON de.empID = e.empID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose that we have following tables create table Employee( 2 EMPNO NUMBER(3), 3 ENAME
I have two tables: a schedule table that contains information about how an employee
I have two tables almost identical: employee employee_history The second table has two additional
I have two tables Department and Employee . Department table looks like this: ID
I have 2 tables: CREATE TABLE employee ( employee_id NUMBER(5), first_name VARCHAR2(20), last_name VARCHAR2(20),
I have two tables. Table A has a list of employee names. Table B
I have two tables - `employee` and `department`. 1. `employee` table contains column id,employee
I have two tables Employee and EmployeeLog (with the same columns except LogCreatedDate )
I have two tables an employee table and a project table and I am
I have two tables TABLE : EMPLOYEE EMP_ID EMP_NAME EMP_TYPE 1 Shwetha 1 2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.