我有两个类似的问题
select *
from openquery(powerschool,
'select *
from TEACHERS
where teachernumber is not null
and schoolid=''1050''
and teacherloginid is not null
order by teachernumber') 和
SELECT *
from openquery(powerschool,
'SELECT NVL(teachernumber,'''')
from TEACHERS
where teachernumber is not null
and schoolid=''1050''
and teacherloginid is not null
order by teachernumber') 第一个给我182行,第二个给我83行。
查询出了什么问题?
发布于 2009-08-04 22:23:35
由于NVL()的存在,第二个查询永远不会为teachers表返回null,因此它可以根据数据返回更多的记录。
基本上,“and teacherloginid is not null”永远不会命中,因为您将null替换为"“
发布于 2009-08-05 18:38:08
只是想法..。
https://stackoverflow.com/questions/1230150
复制相似问题