Ver Mensaje Individual
  #12 (permalink)  
Antiguo 14/12/2013, 04:57
jurena
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Cáceres
Mensajes: 3.735
Antigüedad: 16 años
Puntos: 300
Respuesta: unificar dos consultas

Perdona, IsaBelM, no vi el enlace. Si no quieres usar SQL_CALC_FOUND_ROWS, podrías usar algo parecido a este stored procedure

Código MySQL:
Ver original
  1. DELIMITER ;;
  2. CREATE PROCEDURE todos_y_tot()
  3.     DECLARE tot INT;
  4.     SET tot = 0;
  5.  
  6.     SELECT COUNT(*) total FROM tutabla LIMIT 1 INTO tot;
  7.  
  8.     SELECT *, tot FROM tutabla;
  9. END;;
  10. DELIMITER ;

Y luego lo llamas

Código MySQL:
Ver original
  1. CALL todos_y_tot;

Si todavía piensas que podría interesarte SQL_CALC_FOUND_ROWS, mira aquí
http://stackoverflow.com/questions/2...rows-and-total

Última edición por jurena; 15/12/2013 a las 02:51