Question:
How do combine two Queries or is it only one?
Example:
I have two exact similar tables my PostgreSQL Database. info_table
and info_table_dump
with the exact same columns date_at
, name
, color
and length
. Now i want to know if there are entries in info_table_dump
that do not exist in info_table
. Therefore i made these Query:
SELECT
date_at,name,color,length
FROM
info_table_dump
EXCEPT
SELECT
date_at,name,color,length
FROM
info_table;
The result is fine. It works like i assumed (i created 2 entries that do not match) the none-duplicates are shown. But now i wanted only to fetch the given id
s of the non-duplicate rows. Something like this...
SELECT
id
FROM
info_table_dump
WHERE
(SELECT
date_at,name,color,length
FROM
info_table_dump
EXCEPT
SELECT
date_at,name,color,length
FROM
info_table);
I also tried something with EXISTS
but its not the result i wanted.
So my Question how do combine the Query?
I want only the ìd
s of the info_table_dump
rows, who not already exist in info_table
.