in reply to checking mysql rows continuously
select A.id from table1 A inner join table1 B on (B.id = A.id - 1) where B.status = 'no' and A.status = 'yes'
I think that would give you the id's rows where a "yes" answer immediately follows a "no" answer. (It will not give you initial "yes" answers that are not followed by "no," so manually add "id#1" to your list.) Armed with this answer, select the rows with greater-or-equal IDs and walk them until you encounter a "no."
Although I think that this query will still require "a full table scan," at least it will be the database engine that's doing the heavy lifting.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |