mysql - Circular buffer using SQL -


is possible circular buffer using sql?

i mean, using table mytable:

+----+ | id | +----+ |  1 | |  2 | |  3 | |  4 | |  5 | +----+ 

something like

select id `mytable` order `id` limit 5 offset 3 

would return

+----+ | id | +----+ |  4 | |  5 | |  1 | |  2 | |  3 | +----+ 

if i'm understanding question correctly, you're trying maintain restriction of limit , start ordering offset? if so, perhaps work:

  select id   mytable   order !(id>3), id   limit 5 

i've altered input include 6th record show limit functionality.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -