Using postgres 14.2
I have identical table for each currency, below example for eur and usd.
CREATE TABLE IF NOT EXISTS DOLLAR
(
id serial PRIMARY KEY,
updateTime timestamp,
//some more columns
);
CREATE TABLE IF NOT EXISTS EURO
(
id serial PRIMARY KEY,
updateTime timestamp,
//some more columns
);
Now I need 2 things:
- select all records that have same value under
updateTimeand then print them both (paired).
In other words (pseudo code):
foreach e in EURO
if (exist d in DOLLAR) and (d.updateTime == e.updateTime)
print (e,d)
- Print all rows from EURO that are not printed above
To make things easier updateTime is unique in particular table