|    
			
				01/10/2013, 11:01
			
			
			  | 
  |   |  |  |  Fecha de Ingreso: abril-2013 
						Mensajes: 20
					 Antigüedad: 12 años, 6 meses Puntos: 1 |  | 
  |  Evento Mysql / insert SELECT  
  Muy Buenas a todos!
 Os comento mi problema.
 
 Me gustaría crear un evento diario que utilizaria para hacer un "insert into summarized_table () SELECT [...]". El evento se ejecutaría todos los dias a las 10:00am.
 
 - Esta es la tabla sumarizada donde insertaria los datos agrupados:
 
 create table attemptsub_carrierday_sum (
 id              int(11) not null AUTO_INCREMENT,
 time		date	not null,
 country		int(11)	not null,
 id_carrier	int(11)	not null,
 attempts	int(11)	not null,
 optins		int(11)	not null,
 PRIMARY KEY (id)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8
 
 
 - Y este es el insert que utilizaría para el evento:
 
 INSERT INTO attemptsub_carrierday_sum (time, country, id_carrier, attempts, optins) select DATE(att.created_at) as time , co.id as country , ca.id_carrier , count(att.id) as attempts,
 sum(case when att.api_code = 100 AND att.api_wasactive = 1 AND api_sending_short_code > 0 then 1 else 0 end) as optins
 from attemptsub as att
 LEFT JOIN carrier as ca ON att.id_carrier= ca.id_carrier
 LEFT JOIN country as co ON ca.country_id = co.id
 where created_at between curdate() - interval 2 day and curdate() - interval 1 day
 GROUP BY country, id_carrier, DATE(att.created_at)
 ORDER BY time desc, country, id_carrier
 
 
 My problema es que nunca he hecho un evento en MySQL ( he hecho realizado algun job en oracle pero mysql es diferente!) y apreciaria mucho mucho vuestra ayuda.
 
 Si necesitais mas información estare encantado de ayudar.
 
 Muchas gracias de antemano
 
 Mario
     |