如何写下面的查询而不是不在,写 [英] how to write below query instead of not in ,write in
本文介绍了如何写下面的查询而不是不在,写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在下面的查询中,我该如何写而不是不写?
我想在location_temp中记录,而不在location表中?
how can i write in instead of not in ,in the below query
i want records in location_temp which is not in location table?
select *
from tblLocation_Temp
where tblLocation_Temp.Code
not in (
select tblLocation.Code
from tblLocation )
推荐答案
select *
from tblLocation_Temp
where tblLocation_Temp.Code
not in (
select tblLocation.Code
from tblLocation )
如果"tblLocation.Code"和"tblLocation_Temp.Code"是同一类型列,则此查询是正确的.
如果tblLocation_Temp.Code是numaric或"tblLocation.Code"是varchar,则您的查询存在转换问题. ''通过强制转换为varchar来解决此问题''
我希望此帮助
this query is perfact if " tblLocation.Code " and " tblLocation_Temp.Code " are same type column.
if tblLocation_Temp.Code is numaric or " tblLocation.Code " is varchar then your query have a casting problem . '' solve this by cast as varchar ''
i hope this help
使用条件不存在 [ ^ ]
这是正确的. .....................................感谢shameel
it is correct.............................thanks shameel
这篇关于如何写下面的查询而不是不在,写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文