Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/06/2010, 14:11
jurena
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Cáceres
Mensajes: 3.735
Antigüedad: 16 años
Puntos: 300
Respuesta: Obtener registro anterior y siguiente..

SELECT (

SELECT numerofactura
FROM tutabla
WHERE numerofactura < 29
ORDER BY numerofactura DESC
LIMIT 1
) AS anterior, (

SELECT numerofactura
FROM tutabla
WHERE numerofactura >29
ORDER BY numerofactura ASC
LIMIT 1
) AS posterior