问题描述
你好朋友
我想获取不在另一个表中退出的数据
例如.假设我有两个表A和B,其中包含
表A表B
srprefix srno前缀no
pp/10 1 pp/10 1
pp/10 2 pp/10 2
pp/10 3 pp/10 3
pp/09 3
请帮助我如何获得未在表A中退出的输出
同时检查前缀和无字段
即pp/09 3
我使用了join,但无法正常运行
感谢u
Hello Friends
I want to get the data that does not exits in another table
eg. suppose i have two table A and B which contains
Table A Table B
srprefix srno prefix no
pp/10 1 pp/10 1
pp/10 2 pp/10 2
pp/10 3 pp/10 3
pp/09 3
pls help me how could i get the output which does not exits in Table A
checking both the prefix and no fields
i.e pp/09 3
i used join but it does not work properly
Thank u
推荐答案
select * from B where no NOT IN (SELECT srno from A)
select * from B where no+''''+prefix NOT IN (SELECT srno+''''+srprefix from A)
注意:我没有对此进行测试.因此,您可能会遇到一些错误(并且可能还可以删除''串联)
NOTE: I did not test this. So you might get some errors (and probably you can also remove the '''' concatenation)
这篇关于如何获取不在另一个表SQL Server 2005中退出的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!