Answer the question
In order to leave comments, you need to log in
How to merge two tables with date filtering?
There are two tables in Postgresql:
TableOne
name | timestamp
---------------+-----------
a_one | 2013-07-21
---------------+-----------
b_one | 2018-05-05
TableTwo
name | timestamp
---------------+-----------
a_two | 2015-11-01
---------------+-----------
b_two | 2018-05-15
From these two tables, you need to create a virtual table with the following structure
name | timestamp
---------------+-----------
a_one | 2013-07-21
---------------+-----------
a_two | 2015-11-01
---------------+-----------
b_one | 2018-05-05
---------------+-----------
b_two | 2018-05-15
How to make the right request?
Answer the question
In order to leave comments, you need to log in
SELECT "name", "timestamp" FROM (
SELECT "name", "timestamp" FROM TableOne
UNION ALL
SELECT "name", "timestamp" FROM TableTwo
)
WHERE "timestamp" > '2015-01-01'::timestamp
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question