不在声明中不起作用 [英] Not in statement not working
本文介绍了不在声明中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这段代码
i have this code
select * from FIX_ASSET_upload where ASSET_NUMBER in(select ASSET_NUMBER from scanitem where ASSET_NUMBER not in(select distinct asset_number from SAMPLING))
但是当我使用此代码时我的预期答案没有使用
but my expected answer is not using when i use this code
select ASSET_NUMBER from scanitem where ASSET_NUMBER not in(select distinct asset_number from SAMPLING)
i得到了正确的资产#但是当我使用上面的代码时,它无法正常工作。
i浪费了很多时间。
感谢帮助
i get the the correct asset# but when i use the above code it is not working.
i waste many hours for this.
thanks to the help
推荐答案
查询不是问题,而是我的数据。一些资产#有NEWLINE所以我做的是添加replace()命令
这里是我现在的命令
the query is not the problem but my data. some of the asset# has NEWLINE so what i do is add the replace() command
here is my now command
select * from FIX_ASSET_upload where ASSET_NUMBER in(select ASSET_NUMBER from scanitem where ASSET_NUMBER not in(select distinct REPLACE(Scanitem.ASSET_NUMBER, CHAR(13) + CHAR(10), '') from SAMPLING))
命令替换NEWL INE带有空格('')
感谢 F-ES Sitecore 推荐我使用JOIN。后来我更新了我的非声明加入声明
the command replace the NEWLINE with a space('')
thanks to F-ES Sitecore for recommending me to use the JOIN. later i update my not in statement to join statement
这篇关于不在声明中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文