Ver Mensaje Individual
  #5 (permalink)  
Antiguo 16/09/2010, 14:30
jurena
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Cáceres
Mensajes: 3.735
Antigüedad: 16 años, 1 mes
Puntos: 300
Respuesta: Contar y agrupar

Prueba esto:
SELECT t4.nom, SUM(t4.cont) total FROM ((SELECT nombre1 nom, count(nombre1) cont FROM `tutabla` group by nombre1)
union all
(SELECT nombre2, count(nombre2) FROM `tutabla` group by nombre2)
union all
(SELECT nombre3, count(nombre3) FROM `tutabla` group by nombre3))t4 GROUP BY t4.nom