我很困惑,爲什麼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