Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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
Domain Nodelet?
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 about the Monastery: (2)
As of 2021-10-16 10:07 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (69 votes). Check out past polls.