1

I am having a problem merging two columns from separate tables into one column. Here's the scenario, I have 2 tables each with different columns containing dates. I want to create a temporary table containing a column of all the dates from both original tables.

This is how I want it to turn out:

   Table: Table A
         ----------
Column: DateServiced
        2017-01-01 (1)
        2017-05-01 (2)

   Table: Table B
         ----------
Column: DateShipped
        2017-03-01 (3)
        2017-04-01 (4)

And they would merge into one column on a temporary table.

   Table: Temp Table
         ------------
 Column: MergedDates
         2017-01-01 (1)
         2017-03-01 (3)
         2017-04-01 (4)
         2017-05-01 (2)

NOTE I cannot alter the original tables, and it is fine if there are duplicate dates. The order does matter but whether it's newest or oldest first does not matter.

1
  • 1
    and any reason, you cannot use UNION ? Commented Jun 28, 2017 at 14:23

1 Answer 1

2

UNION should help you

SELECT DateServiced
  FROM TABLE A
 UNION 
SELECT DateShipped
  FROM TABLE B;
Sign up to request clarification or add additional context in comments.

1 Comment

@MatthewBarbara - If the above helped, an accept would be good for others :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.