Answer the question
In order to leave comments, you need to log in
How to find discrepancies in two MYSQL tables?
There are two tables.
Both have two identical fields.
Table 1
field product_identificator
field count
field features
field price
Table 2
field product_identificator
field count
field remains
We need to find records that have discrepancies in the count field, that is, in theory, the values should correspond to each other, and with this query I want to find discrepancies
Answer the question
In order to leave comments, you need to log in
Is something like this not working?
SELECT *
FROM Таблица 1 AS t1
LEFT JOIN Таблица 2 AS t2
ON t1.product_identificator=t2.product_identificator
WHERE t1.count <> t2.count
I'm guessing something like:
select table1.product_identificator, table1.count from table1 left join table2 on table1.product_identificator = table2.product_identificator where table1.count != table2.count;
(SELECT product_identificator, count
FROM Table 1
EXCEPT
SELECT product_identificator, count
FROM Table 2)
UNION
(SELECT product_identificator, count
FROM Table 2
EXCEPT
SELECT product_identificator, count
FROM Table 1)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question