如何从表A中选择多个不在表B中的记录 [英] How to select multiple records from Table A which are not in Table B
问题描述
有人可以在这个问题上帮助我吗:
仅当表B中的行不可用时,我才想从表A中选择多个记录.
例如:
表A:
ID名称
2个Aaa
3 bbb
14 ccc
15 ddd
16 eee
表B:
ID名称
15 ddd
16 eee
20 ggg
21 hhh
然后我的输出应该是:
ID名称
20 ggg
21 hhh
有人可以帮我写SQL语句来执行此查询吗?我在这里停留在我的项目中.我会非常感激的.
谢谢和问候,
Gopal
Can someone please help me on this issue:
I want to select multiple records from Table A only if the rows are not available in Table B.
For example:
Table A:
ID Name
2 aaa
3 bbb
14 ccc
15 ddd
16 eee
Table B:
ID Name
15 ddd
16 eee
20 ggg
21 hhh
Then my output should be:
ID Name
20 ggg
21 hhh
Can somebody please help me to write SQL statement to do execute this query. I am stuck up here in my project. I ll be really thankful.
Thanks and regards,
Gopal
推荐答案
尝试类似的操作:
Try something like that:
select * from TableA
where ID not in (select ID from TableB)
希望对您有用.
-----------
我的网站:
卡萨斯(Guasulhos)镇
I hope it is useful.
-----------
My site:
Casas a venda em Guarulhos
有效:
SELECT * FROM B AS p
WHERE NOT EXISTS
(SELECT * FROM A AS pm
WHERE p.Names= pm.Names)
这篇关于如何从表A中选择多个不在表B中的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!