Answer the question
In order to leave comments, you need to log in
How to compare rows in two different tables?
I have two tables. These two tables have the same column names, I need to compare a row from the first table where id = 1 and a row from another table where id is 1, and if all the values match, display it fits how it can be done, nothing comes to mind
Answer the question
In order to leave comments, you need to log in
SELECT *
FROM table1 AS t1
LEFT JOIN table2 AS t2
ON t1.id = t2.id
WHERE
t1.id = ? AND
row_to_json(t1.*) @> row_to_json(t2.*) AND
row_to_json(t1.*) <@ row_to_json(t2.*);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question