Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/05/2008, 23:09
jurena
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Cáceres
Mensajes: 3.735
Antigüedad: 16 años, 10 meses
Puntos: 300
Re: con UNION ALL

Si lo que quieres es unir las 12 tablas y que, tras ordenar de manera descendente por los campos fecha y hora, te muestre sólo los 20 primeros, puedes hacer esto.

(SELECT fecha AS C1, hora AS C2 FROM tabla1)
UNION ALL
(SELECT FROM fecha, hora FROM tabla2)
UNION ALL
(SELECT FROM fecha, hora FROM tabla3)
UNION ALL
(SELECT FROM fecha, hora FROM tabla4)
//... hasta la tabla12

ORDER BY C1 DESC, C2 DESC LIMIT 20