Kcko
12/23/2018 - 4:09 PM

Nejblizsi vyssi / nizsi zaznam

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