SQLite Forum

How to implement a table working like a ring buffer
Login
I'd expect `exists` to *short-circuit*, so the inner `limit 1` shouldn't be necessary.

And the `order by ID` shouldn't be necessary either.

And finally, I tend to use `select 1 ...` instead of any *real* column.

So just `exists (select 1 from t where GroupID = o.GroupID and ID > o.ID)`