Ver Mensaje Individual
  #3 (permalink)  
Antiguo 07/11/2011, 12:26
rahmat
 
Fecha de Ingreso: octubre-2011
Ubicación: Buenos Aires
Mensajes: 6
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: Contar registros de varias tablas con nombre y resultado Mysql

Contar registros de varias tablas con nombre y resultado Mysql
Hola, mi nombre es Rahmat, primeramente gracias por tus aportes.

Pero tengo esta duda con respecto de contar los registros de una BD:::

1)- Al hacer esta sentencia:

SELECT sum(table_rows) total_regs
FROM information_schema.`tables` t
WHERE table_schema = 'santiago1';

Me da como resultado un total de 960.026 registros.

2)- Al hacer esta sentencia:

SELECT TABLE_NAME, table_rows total_regs
FROM information_schema.`tables` t
WHERE table_schema = 'santiago1';

y al exportarlo en excel y al sumarlo da 958.951;

Y 3)- Al hacer esta sentencia:

SELECT COUNT(0) FROM tabla1
UNION
SELECT COUNT(0) FROM tabla2
UNION
SELECT COUNT(0) FROM tabla3
UNION
SELECT COUNT(0) FROM tabla4
UNION
SELECT COUNT(0) FROM tabla.... hasta llegar al 85;

me dá como resultado 962.700 registros.

Como verás, tengo 3 resultados distintos (960.026, 958.951 y 962.700), conltando en otros lados nadie dá pié con bolas....SI ME PUEDEN DAR UNA MANO PARA SABER CUAL ES LA VERDAD DE ESTAS BUSQUEDAS Y SABER ESACTAMENTE CUAL ES EL VEDADERO VALOR.

DISCULPA LAS MOLESTIAS, PERO DE APOCO ESTOY APRENDIENDO ESTE LENGUAJE.

sALUDOS y gracias POR TU AYUDA