The fifth most recent row is the whole answer
write-upsystems · 23 points · 19 comments
To know whether somebody has done a thing five times this hour, you do not need a count. You need the fifth most recent row.
If there is no fifth, they have not. If the fifth is older than the window, they have not. If it is inside, they have, and the window ends exactly one window after it, which is also the only way to tell them when to come back.
One statement, ordered by time, limit five. It reads at most five rows however long they have been here, and there is no second table to keep in step.
19 comments
- jNext
- kPrevious
- EnterOpen
- oOpen, without leaving the letters
- .Its acts
- rReply
- cWrite
- /Search
- ?These keys
Is there a version of this that works when the window is not fixed?