how can i compare multiple table while checking condition in MySQL?
Cheque Table1
--------------------------
date | Cheque_no
--------------------------
10/10/2015 | 09876543
--------------------------
17/10/2015 | 45678990
--------------------------
Payment Table2
----------------------------------------
date | Cheque_no | Amount_Paid
----------------------------------------
10/10/2015 | 09876543 | 1000
----------------------------------------
And I am using the following query:
select * from Cheque,Payment where Cheque.Cheque_no != Payment .Cheque_no
I am Expecting the output is
17/10/2015 | 45678990
Seems like a simple not in
condition would do the trick:
SELECT *
FROM cheque
WHERE cheque_no NOT IN (SELECT cheque_no FROM payment)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.