Hi
let's think we have a table (with 2 fields those areversion
,compatible
) with data as follow :
+-------+------+
| 0.1.1 | true |
+-------+------+
| 0.1.2 | false|
+-------+------+
| 0.1.3 | true |
+-------+------+
| 0.1.4 | true |
+-------+------+
| 0.1.5 | true |
+-------+------+
| 0.1.6 | false|
+-------+------+
| 0.1.7 | true开发者_如何转开发 |
now i want to select all rows where version = '0.1.3'
from prior row that compatible = false
to next row that compatible = false
0.1.2
, 0.1.3
, 0.1.4
, 0.1.5
how can i do that ?SELECT version, compatible
FROM YourTable
WHERE version >= '0.1.3'
AND version < (SELECT version
FROM YourTable
WHERE version > '0.1.3'
AND compatible = 'false'
ORDER BY version
LIMIT 1)
ORDER BY version
精彩评论