table A
|-------------|
|mohonID |nama|
---------------
|1111 |xxx |
|2222 |yyy |
--------------
Table B
|-------------|
|mohonID |nama|
---------------
|1111 |xxx |
---------------
result
|-------------|
|mohonID |nama|
---------------
|2222 |yyy |
--------------
That is my example table. how i want to view data from table A that table B no have data. Example table that i want to view is table RESULT. using mysql statement.
MySQL 不支持 EXCEPT 运算符,但您可以执行以下操作:
SELECT * FROM TableA WHERE mohonID NOT IN(SELECT mohonID FROM TableB)
Here is one way of doing it
select tablea.*
from tablea a
left join tableb b
on a.mohonID=b.mohonID and a.nama=b.nama
where b.mohonID is null
and here is another
select tablea.*
from tablea a
where not exists(
select *
from tableb b
where a.mohonID=b.mohonID and a.nama=b.nama)
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.