Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: checking mysql rows continuously

by Anonymous Monk
on Dec 08, 2020 at 14:03 UTC ( #11124832=note: print w/replies, xml ) Need Help??

in reply to checking mysql rows continuously

How about something vaguely like this ... an inner-join of a table to itself:

select from table1 A inner join table1 B on ( = - 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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11124832]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2021-03-05 11:13 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (109 votes). Check out past polls.