Skip to content

Instantly share code, notes, and snippets.

@Kcko
Created December 23, 2018 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kcko/96984372a62ef2968b55907d04b937f0 to your computer and use it in GitHub Desktop.
Save Kcko/96984372a62ef2968b55907d04b937f0 to your computer and use it in GitHub Desktop.
SELECT a.id AS nejblizsi_nizsi, b.id AS nejblizsi_vyssi
FROM `tabulka` a JOIN `tabulka` b ON (a.id < $id AND b.id>$id)
ORDER BY (b.id-a.id) ASC LIMIT 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment