[英]SQLite: OR and |
以下查詢在SQL Server中有效,但在SQLite 3.8.7中不可用,我想知道為什么。
表
l | r
0 | 10
0 | 2
8 | 10
詢問
SELECT * FROM Segments AS s1
LEFT JOIN Segments AS s2
ON ((s2.l <= s1.l AND s2.r > s1.r)
OR (s2.l < s1.l AND s2.r >= s1.r));
預期產量
s1.l | s1.r | s2.l | s2.r
0 | 10 | null | null
0 | 2 | 0 | 10
8 | 10 | 0 | 10
但是我得到了
s1.l | s1.r | s2.l | s2.r
0 | 10 | 0 | 2
0 | 2 | 0 | 10
8 | 10 | 0 | 10
當我切換表達順序時
((s2.l < s1.l AND s2.r >= s1.r) (s2.l <= s1.l AND s2.r > s1.r))
我有
s1.l | s1.r | s2.l | s2.r
0 | 10 | 8 | 10
0 | 2 | 0 | 10
8 | 10 | 0 | 10
這是通過使用|解決的。 而不是OR,但我想知道為什么OR無效?
這是SQLFiddle上的示例http://sqlfiddle.com/#!7/15859/22/1
謝謝
這是SQLite 3.8.7.2中修復的錯誤 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.