'Difference between two results in MYSQL
I am looking to find difference between my two query results. Following are my queries:
Query 1:
SELECT
COUNT(*) AS Total
FROM
transaction
WHERE
last_local_call_time >= '2022-03-04 00:00:00'
AND last_local_call_time < '2022-03-05 00:00:00';
Result 1:
Total
--------
213966
Query 2:
SELECT
COUNT(*) AS Total
FROM
transaction
WHERE
modify_date >= '2022-03-04 00:00:00'
AND modify_date < '2022-03-05 00:00:00';
Result 2:
Total
--------
877349
I want to find Query1-Quer2 results (not row count but content). Following is one of my many failed attempts:
SELECT *
FROM transaction
WHERE VALUE IN (SELECT * FROM transaction WHERE modify_date >= '2022-03-04 00:00:00' AND modify_date < '2022-03-05 00:00:00';)
AND NOT IN (SELECT * FROM transaction WHERE last_local_call_time >= '2022-03-04 00:00:00' AND last_local_call_time < '2022-03-05 00:00:00';)
Any assistance would be appericiated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
