
16/05/2008, 01:05
|
Colaborador | | Fecha de Ingreso: marzo-2008 Ubicación: Sabadell
Mensajes: 4.897
Antigüedad: 17 años Puntos: 574 | |
Respuesta: Contar y agrupar datos de una tabla Tienes weekday() y en el manual de mysql toda las funciones relacionadas con las fechas Cita: WEEKDAY(date)
Returns the weekday index for date (0 = Monday, 1 = Tuesday, … 6 = Sunday).
mysql> SELECT WEEKDAY('1998-02-03 22:23:00');
-> 1
mysql> SELECT WEEKDAY('1997-11-05');
-> 2
Código:
SELECT Year(log_0.fecha) as `año`, WEEKDAY(log_0.fecha) as `Día`, COUNT(*) FROM mitabla.log log_0
group by Year(log_0.fecha), WEEKDAY(log_0.fecha)
HAVING log_0.fecha>='01/04/2008' AND log_0.fecha<'14/5/2008';
Quim |