我很困惑,为什么Postgresql定位函数为什么看起来是一个简单的测试给出了不同的结果。为什么Postgres position()函数会给出不同的结果?
这里查询#1:
SELECT count(*)
FROM
dnasample D, ibg_studies ST, subjects S
WHERE
D.studyindex=ST.studyindex
AND ST.studyabrv='CONGER'
AND D.subjectidkey=S.id
AND D.projectindex IS NULL
AND POSITION('Previous subjectid:' in D.comment) IS NULL
返回的246
然后在这里一个结果是查询#2:
SELECT count(*)
FROM
dnasample D, ibg_studies ST, subjects S
WHERE
D.studyindex=ST.studyindex
AND ST.studyabrv='CONGER'
AND D.subjectidkey=S.id
AND D.projectindex IS NULL
AND POSITION('Previous subjectid:' in D.comment)=0
我不明白为什么这回这样的不同的结果?
我试着读Postgres的文件,以澄清区别零和空字符串,但没有多少运气还存在之间...
由于提前, --Rick
谢谢;我明白现在的差异;很好的答案。 – rixter 2011-12-20 23:14:16
已回答此问题...不再需要! – rixter 2011-12-20 23:15:29