Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá galera...
Estou com um probleminha, estou querendo calcular uma media entre datas, mas está retorando errado.
Ex:
O Funcionário João tem desde o incio do ano 4 horas de hora extra. No calculo dessa media seria 4/9, onde o 9 é o número de meses desde o inicio do ano, o qual o resultado seria 0,44, mas está retornando 2.
Alguem poderia dizer onde está o erro no código?
SELECT login, sum(hora1) as horat1, AVG( hora1 ) AS mediah1 FROM totalhoras WHERE data BETWEEN '2011-01-01' AND '2011-09-30' GROUP BY login ORDER BY mediah1 ASC
Ele ordena pela media.
Obrigado
>
Posta o exemplo da sua tabela com a inserção de dados amigo, para podermos testar.
Assim fica mais fácil de ajudar a fazer a query correta, pois podemos fazer testes.
Segue a tabela e as informações para testar.
CREATE TABLE `totalhoras` (
`id` int(8) NOT NULL auto_increment,
`login` varchar(50) collate latin1_bin default NULL,
`hora1` double default NULL,
`hora2` double default NULL,
`adicional` double default NULL,
`data` date default NULL,
`idescala` int(8) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin AUTO_INCREMENT=575 ;
--
-- Extraindo dados da tabela totalhoras
--
INSERT INTO `totalhoras` VALUES (1, 0x414c4349444553, 4, 4, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (2, 0x414c4558414e445245, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (3, 0x414c4d45494441, 10, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (4, 0x414d4f52494d, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (5, 0x414e445245204c55495a, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (6, 0x424f52474553, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (7, 0x434152444f534f, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (8, 0x434152494f4e49, 2.5, 0, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (9, 0x4341524d494e41545449, 10, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (10, 0x434841524c4553, 0, 6, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (11, 0x43485249535449414e, 3, 12, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (12, 0x434c415544454d4952, 4, 4, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (13, 0x434c4549544f4e, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (14, 0x44454e495a, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (15, 0x44494153, 10, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (16, 0x4455545241, 10, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (17, 0x4544554152444f, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (18, 0x454c41495341, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (19, 0x45564552544f4e, 10, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (20, 0x455a45515549454c, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (21, 0x46414249414e4f, 10, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (22, 0x464142494f, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (23, 0x46494c49505049, 0, 6, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (24, 0x464c4f5249414e4f, 9, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (25, 0x4741425249454c, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (26, 0x47494c424552544f, 10, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (27, 0x474f444f49, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (28, 0x485544534f4e, 10, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (29, 0x4a41494d45, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (30, 0x4a414e444552534f4e, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (31, 0x4a45464552534f4e, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (32, 0x4a4f535545, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (33, 0x4a5543414d4152, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (34, 0x4a554c49414e4f2050455245495241, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (35, 0x4c414954414e4f, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (36, 0x4c415249535341, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (37, 0x4c45414c, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (38, 0x4c45494c41, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (39, 0x4c55434941, 10, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (40, 0x4c554953204755535441564f, 5, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (41, 0x4c55495a, 2, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (42, 0x4d415243494f, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (43, 0x4d415249414e4f, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (44, 0x4d4152495354454c41, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (45, 0x4d415251554553, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (46, 0x4d45444549524f53, 10, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (47, 0x4d454c49535341, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (48, 0x4d45535155495441, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (49, 0x4d4952414e4441, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (50, 0x4d4f5245495241, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (51, 0x4e415343494d454e544f, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (52, 0x5041545249434b, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (53, 0x5041554c41, 6, 4, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (54, 0x50455245495241, 0, 12, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (55, 0x524144414d4553, 10, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (56, 0x5249434152444f, 10, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (57, 0x524f424552544f, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (58, 0x524f434841, 10, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (59, 0x524f445249474f, 8, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (60, 0x53414e44524f, 10, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (61, 0x53415241495641, 8, 6, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (62, 0x53494c5641, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (63, 0x53494d4f4e, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (64, 0x5448414953, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (65, 0x5641474e4552, 10, 0, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (66, 0x5641535155455a, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (67, 0x564944414c, 0, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (68, 0x564945495241, 2.5, 0, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (69, 0x57494c4c49414e53, 4, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (70, 0x5a494d4d45524d414e4e, 3, 10, 0, '2011-01-01', 1);
INSERT INTO `totalhoras` VALUES (71, 0x414c4d45494441, 8, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (72, 0x414e445245204c55495a, 4, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (73, 0x424f52474553, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (74, 0x42524153494c, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (75, 0x434152444f534f, 0, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (76, 0x4341524d494e41545449, 0, 7, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (77, 0x43485249535449414e, 3, 12, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (78, 0x434c415544454d4952, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (79, 0x434f52524541, 8.5, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (80, 0x44414e49454c, 0, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (81, 0x44452046524549544153, 0, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (82, 0x44454d49414e, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (83, 0x44454e495a, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (84, 0x44494153, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (85, 0x4455545241, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (86, 0x4544554152444f, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (87, 0x45564552544f4e, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (88, 0x455a45515549454c, 6, 9, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (89, 0x46414249414e4f, 5, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (90, 0x4645524e414e444f, 0, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (91, 0x464c4f5249414e4f, 0, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (92, 0x4741425249454c, 3, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (93, 0x47494c424552544f, 0, 5, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (94, 0x485544534f4e, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (95, 0x4a41494d45, 4, 3, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (96, 0x4a414e444552534f4e, 6, 3, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (97, 0x4a45464552534f4e, 3, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (98, 0x4a4f454c, 4, 9, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (99, 0x4a4f535545, 0, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (100, 0x4a554c49414e4f2050455245495241, 0, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (101, 0x4c414954414e4f, 6, 9, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (102, 0x4c415249535341, 8.5, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (103, 0x4c45494c41, 0, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (104, 0x4c55434941, 5, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (105, 0x4c5543494e4541, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (106, 0x4c554953204755535441564f, 5, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (107, 0x4c55495a, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (108, 0x4d415243494f, 3, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (109, 0x4d4152495354454c41, 0, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (110, 0x4d415251554553, 0, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (111, 0x4d4152544152454c4c4f, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (112, 0x4d415254494e53, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (113, 0x4d4155524943494f, 4, 3, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (114, 0x4d45444549524f53, 6, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (115, 0x4d45535155495441, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (116, 0x4d494755454c, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (117, 0x4d4952414e4441, 0, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (118, 0x4e415343494d454e544f, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (119, 0x4e554e4553, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (120, 0x4f4c495645495241, 10, 14, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (121, 0x50455245495241, 6, 3, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (122, 0x50494552494e49, 0, 6, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (123, 0x5155494e54, 0, 20, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (124, 0x524144414d4553, 7, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (125, 0x5249434152444f, 2, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (126, 0x524f424552544f, 4, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (127, 0x524f434841, 1.5, 0, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (128, 0x524f445249474f, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (129, 0x53414e44524f, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (130, 0x53494c5641, 0, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (131, 0x534f555a41, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (132, 0x5641474e4552, 3, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (133, 0x5641535155455a, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (134, 0x564945495241, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (135, 0x57494c4c49414e53, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (136, 0x5a494d4d45524d414e4e, 10, 10, 0, '2011-02-05', 2);
INSERT INTO `totalhoras` VALUES (137, 0x414c4558414e445245, 1.5, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (138, 0x414d4f52494d, 0, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (139, 0x424f52474553, 5, 0, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (140, 0x42524153494c, 5, 0, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (141, 0x43485249535449414e, 10, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (142, 0x434c415544454d4952, 5, 0, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (143, 0x434c4549544f4e, 1.5, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (144, 0x434f52524541, 7.5, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (145, 0x44454d49414e, 0, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (146, 0x44454e495a, 5, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (147, 0x44494153, 1.5, 0, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (148, 0x4455545241, 10, 1.67, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (149, 0x4544554152444f, 0.5, 8, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (150, 0x454c41495341, 0, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (151, 0x45564552544f4e, 10, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (152, 0x455a45515549454c, 1.5, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (153, 0x464142494f, 0, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (154, 0x4645525245495241, 0, 8, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (155, 0x464c4f5249414e4f, 3, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (156, 0x474f444f49, 1.5, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (157, 0x485544534f4e, 10, 5, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (158, 0x4a41494d45, 0, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (159, 0x4a4f454c, 0, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (160, 0x4a554c49414e4f2050455245495241, 0, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (161, 0x4c414954414e4f, 1.5, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (162, 0x4c415249535341, 0, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (163, 0x4c45414c, 0, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (164, 0x4c45494c41, 0, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (165, 0x4c494d4153, 3, 0, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (166, 0x4c55434941, 4.5, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (167, 0x4c5543494e4541, 0, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (168, 0x4c55495a, 10, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (169, 0x4d415243494f, 0, 8, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (170, 0x4d4152495354454c41, 0, 8, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (171, 0x4d4152544152454c4c4f, 8, 8, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (172, 0x4d415254494e53, 1.5, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (173, 0x4d4155524943494f, 3, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (174, 0x4d45444549524f53, 5, 0, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (175, 0x4d494348454c49, 0, 8, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (176, 0x4d494755454c, 8, 8, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (177, 0x4d4f5245495241, 0, 8, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (178, 0x4e415343494d454e544f, 5, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (179, 0x4e554e4553, 3.5, 8, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (180, 0x50455245495241, 0, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (181, 0x5155494e54, 4.5, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (182, 0x524144414d4553, 3, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (183, 0x5249434152444f, 0, 8, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (184, 0x524f424552544f, 0, 8, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (185, 0x524f434841, 0, 8, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (186, 0x524f445249474f, 1.5, 8, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (187, 0x53414e44524f, 0, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (188, 0x534f555a41, 10, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (189, 0x5448414953, 0, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (190, 0x5641474e4552, 3, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (191, 0x5641535155455a, 5, 0, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (192, 0x564552414e49, 0, 8, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (193, 0x564944414c, 0, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (194, 0x564945495241, 20, 0, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (195, 0x57494c4c49414e53, 5, 7, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (196, 0x5a494d4d45524d414e4e, 0.5, 10, 0, '2011-03-05', 3);
INSERT INTO `totalhoras` VALUES (197, 0x414c4349444553, 0, 8, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (198, 0x414e445245204c55495a, 0, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (199, 0x434152494f4e49, 3, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (200, 0x4341524c41, 0, 7, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (201, 0x43485249535449414e, 10, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (202, 0x434c4549544f4e, 9, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (203, 0x434f52524541, 0, 6, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (204, 0x44414e49454c, 0, 7, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (205, 0x44452046524549544153, 0, 8, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (206, 0x44454d49414e, 2, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (207, 0x44454e495a, 0, 6, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (208, 0x4455545241, 0, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (209, 0x4544534f4e, 10, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (210, 0x4544554152444f, 4.5, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (211, 0x454d4944494f, 4.5, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (212, 0x45564552544f4e, 10, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (213, 0x46414249414e4f, 10, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (214, 0x464142494f, 6, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (215, 0x4645525245495241, 0, 7, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (216, 0x464c4f5249414e4f, 2, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (217, 0x474f444f49, 0, 5.5, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (218, 0x4a414e444552534f4e, 3, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (219, 0x4a45464552534f4e, 10, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (220, 0x4a4f454c, 2, 0, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (221, 0x4a4f535545, 0, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (222, 0x4a554c49414e4f2050455245495241, 0, 6, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (223, 0x4a554e494f52, 2, 0, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (224, 0x4b4152494e41, 0, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (225, 0x4c414954414e4f, 0, 8, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (226, 0x4c415249535341, 0, 6, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (227, 0x4c45494c41, 0, 6, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (228, 0x4c494d4153, 0, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (229, 0x4c55434941, 0, 7, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (230, 0x4c554953204755535441564f, 0, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (231, 0x4c55495a, 1.5, 0, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (232, 0x4d415243494f, 0, 8, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (233, 0x4d415251554553, 0, 7, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (234, 0x4d415254494e53, 10, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (235, 0x4d4155524943494f, 2, 0, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (236, 0x4d45444549524f53, 0, 0, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (237, 0x4d494348454c49, 0, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (238, 0x4d494755454c, 10, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (239, 0x4d4952414e4441, 3, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (240, 0x4d4f5245495241, 0, 7, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (241, 0x4e415343494d454e544f, 6, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (242, 0x4e554e4553, 0, 6, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (243, 0x4f4c495645495241, 3, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (244, 0x5041554c41, 0, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (245, 0x50455245495241, 6, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (246, 0x50494552494e49, 0, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (247, 0x5155494e54, 0, 6, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (248, 0x5249434152444f, 0, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (249, 0x524f424552544f, 0, 6, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (250, 0x524f434841, 6, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (251, 0x53414e44524f, 0, 8, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (252, 0x5343484d495454, 6, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (253, 0x534f555a41, 10, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (254, 0x5448414953, 4.5, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (255, 0x5641474e4552, 0, 6, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (256, 0x57494c4c49414e53, 9, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (317, 0x4d45535155495441, 6, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (318, 0x52414641454c, 0, 10, 0, '2011-04-02', 4);
INSERT INTO `totalhoras` VALUES (319, 0x414c4d45494441, 0, 7, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (320, 0x414e445245534156454e54555241, 3, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (321, 0x4341524c41, 0, 6, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (322, 0x43485249535449414e, 0, 6, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (323, 0x44414e49454c, 0, 6, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (324, 0x444549564944, 0, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (325, 0x44454e495a, 0, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (326, 0x44494153, 0, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (327, 0x4544554152444f, 0, 7, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (328, 0x4553544546414e454c4c45, 3, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (375, 0x455a45515549454c, 6, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (376, 0x464c4f5249414e4f, 0, 8, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (377, 0x4741425249454c, 3, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (378, 0x4a414e444552534f4e, 0, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (379, 0x4a45464552534f4e, 2, 0, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (380, 0x4a4f454c, 0, 4, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (381, 0x4a4f535545, 0, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (382, 0x4a554c49414e4f2050455245495241, 0, 6, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (383, 0x4c414954414e4f, 0, 4, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (384, 0x4c45414c, 10, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (385, 0x4c494d4153, 3, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (386, 0x4c55434941, 0, 6, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (387, 0x4c5543494e4541, 0, 8, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (388, 0x4c554953204755535441564f, 0, 8, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (389, 0x4d415243494f, 0, 6, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (390, 0x4d4152495354454c41, 3, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (391, 0x4d415251554553, 0, 7, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (392, 0x4d4152544152454c4c4f, 0, 7, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (393, 0x4d415254494e53, 1, 0, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (394, 0x4d454c49535341, 3.75, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (395, 0x4d494755454c, 5, 0, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (396, 0x4e415343494d454e544f, 3.75, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (397, 0x4e554e4553, 10, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (398, 0x5041554c41, 3.75, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (399, 0x50455245495241, 0, 8, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (400, 0x5155494e54, 0, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (401, 0x524144414d4553, 0, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (402, 0x5249434152444f, 0, 6, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (403, 0x524f424552544f, 0, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (404, 0x524f434841, 3.75, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (405, 0x524f445249474f, 3.75, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (406, 0x53414e44524f, 0, 7, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (407, 0x534f555a41, 3, 10, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (408, 0x5641474e4552, 0, 8, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (409, 0x5641535155455a, 0, 7, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (410, 0x57494c4c49414e53, 0, 6, 0, '2011-05-07', 5);
INSERT INTO `totalhoras` VALUES (411, 0x414c4349444553, 0, 9, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (412, 0x414c4558414e445245, 6, 10, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (413, 0x414c4d45494441, 0, 6, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (414, 0x414e445245204c55495a, 0, 6, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (415, 0x4341524d494e41545449, 0, 10, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (416, 0x43485249535449414e, 0, 7, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (417, 0x434c4155444941, 0, 3, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (418, 0x434c4549544f4e, 0, 9, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (419, 0x434f52524541, 0, 5, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (420, 0x44452046524549544153, 0, 8, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (421, 0x44454d49414e, 4.5, 10, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (422, 0x44454e495a, 0, 7, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (423, 0x44494153, 1, 7, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (424, 0x4544534f4e, 10, 10, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (425, 0x4544554152444f, 0, 9, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (426, 0x4553544546414e454c4c45, 0, 6, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (427, 0x45564552544f4e, 0, 7, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (428, 0x46414249414e4f, 4.5, 10, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (429, 0x4645525245495241, 1.5, 10, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (430, 0x464c4f5249414e4f, 0, 8, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (431, 0x485544534f4e, 0, 6, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (432, 0x4a41494d45, 0, 6, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (433, 0x4a45464552534f4e, 4.5, 10, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (434, 0x4a5543414d4152, 1, 7, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (435, 0x4a554c49414e4f2050455245495241, 1, 7, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (436, 0x4c414954414e4f, 0, 6, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (437, 0x4c415249535341, 0, 6, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (438, 0x4c45414c, 10, 10, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (439, 0x4c554953204755535441564f, 0, 8, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (440, 0x4c55495a, 0, 7, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (441, 0x4d4152495354454c41, 0, 6, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (442, 0x4d415251554553, 1, 7, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (443, 0x4d4152544152454c4c4f, 0, 9, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (444, 0x4d4155524943494f, 1, 7, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (445, 0x4e415343494d454e544f, 0, 6, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (446, 0x4e554e4553, 5, 9, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (447, 0x5041554c41, 0, 6, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (448, 0x5155494e54, 0, 9, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (449, 0x524144414d4553, 0, 6, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (450, 0x5249434152444f, 0, 9, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (451, 0x524f424552544f, 0, 9, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (452, 0x524f445249474f, 0, 8, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (453, 0x524f5349414e45, 0, 3, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (454, 0x53494c5641, 7.5, 10, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (455, 0x534f555a41, 0, 7, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (456, 0x5448414953, 1.5, 10, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (457, 0x5641474e4552, 0, 1.5, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (458, 0x564945495241, 0, 9, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (459, 0x57494c4c49414e53, 3, 10, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (460, 0x5a494d4d45524d414e4e, 10, 10, 0, '2011-06-04', 6);
INSERT INTO `totalhoras` VALUES (461, 0x414c4349444553, 0, 8, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (462, 0x414c4d45494441, 0, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (463, 0x414d4f52494d, 0, 8, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (464, 0x414e41, 0, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (465, 0x434152494f4e49, 0, 9.5, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (466, 0x4341524d494e41545449, 0, 8, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (467, 0x434c4155444941, 1, 7, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (468, 0x434f52524541, 5, 1, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (469, 0x444549564944, 0, 8, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (470, 0x4455545241, 0, 8, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (471, 0x4544534f4e, 4, 0, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (472, 0x4544554152444f, 5, 9, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (473, 0x454c41495341, 0, 8, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (474, 0x4553544546414e454c4c45, 0, 8, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (475, 0x45564552544f4e, 10, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (476, 0x455a45515549454c, 0, 8, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (477, 0x464c4f5249414e4f, 0, 8, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (478, 0x474f444f49, 0, 8, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (479, 0x485544534f4e, 1.5, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (480, 0x49535241454c, 0, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (481, 0x4a41494d45, 5, 8, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (482, 0x4a414e444552534f4e, 2.5, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (483, 0x4a4f454c, 1, 7, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (484, 0x4a4f4e4153, 0, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (485, 0x4a554c49414e4f2050455245495241, 0, 9.5, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (486, 0x4c45414c, 10, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (487, 0x4c45494c41, 0, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (488, 0x4c494d4153, 3, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (489, 0x4c5543494e4541, 1.5, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (490, 0x4d415251554553, 4.75, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (491, 0x4d4152544152454c4c4f, 1, 7, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (492, 0x4d415254494e53, 0, 8, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (493, 0x4d454c49535341, 0, 9.5, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (494, 0x4d494348454c49, 0, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (495, 0x4e554e4553, 6, 7, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (496, 0x4f4c495645495241, 0, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (497, 0x5041554c41, 1, 7, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (498, 0x50455245495241, 3, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (499, 0x524f424552544f, 1, 7, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (500, 0x524f434841, 1, 7, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (501, 0x524f5349414e45, 0, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (502, 0x5343484d495454, 0, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (503, 0x534f555a41, 0, 12, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (504, 0x5641474e4552, 4, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (505, 0x5641535155455a, 1, 7, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (506, 0x564552414e49, 3, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (507, 0x564945495241, 0, 8, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (509, 0x5a494d4d45524d414e4e, 0, 10, 0, '2011-07-02', 7);
INSERT INTO `totalhoras` VALUES (510, 0x434152494f4e49, 0, 7, 3, '2011-08-13', 8);
INSERT INTO `totalhoras` VALUES (511, 0x434c415544494f, 0, 8, 3, '2011-08-13', 8);
INSERT INTO `totalhoras` VALUES (512, 0x444549564944, 0, 7, 3, '2011-08-13', 8);
INSERT INTO `totalhoras` VALUES (513, 0x44494153, 0, 7, 3, '2011-08-13', 8);
INSERT INTO `totalhoras` VALUES (514, 0x4645525245495241, 0, 8, 3, '2011-08-13', 8);
INSERT INTO `totalhoras` VALUES (515, 0x4a4f4e4153, 0, 8, 3, '2011-08-13', 8);
INSERT INTO `totalhoras` VALUES (516, 0x4a5543414d4152, 0, 8, 3, '2011-08-13', 8);
INSERT INTO `totalhoras` VALUES (517, 0x4d415254494e53, 0, 7, 3, '2011-08-13', 8);
INSERT INTO `totalhoras` VALUES (518, 0x4d4155524943494f, 0, 8, 3, '2011-08-13', 8);
INSERT INTO `totalhoras` VALUES (519, 0x434f52524541, 0, 10, 0, '2011-08-20', 9);
INSERT INTO `totalhoras` VALUES (520, 0x4645525245495241, 10, 2, 0, '2011-08-20', 9);
INSERT INTO `totalhoras` VALUES (521, 0x4c45414e44524f, 0, 10, 0, '2011-08-20', 9);
INSERT INTO `totalhoras` VALUES (522, 0x5448414953, 0, 10, 0, '2011-08-20', 9);
INSERT INTO `totalhoras` VALUES (523, 0x4341524c41, 0, 8, 3, '2011-08-20', 10);
INSERT INTO `totalhoras` VALUES (524, 0x44414e49454c, 0, 8, 3, '2011-08-20', 10);
INSERT INTO `totalhoras` VALUES (525, 0x4d45444549524f53, 0, 8, 3, '2011-08-20', 10);
INSERT INTO `totalhoras` VALUES (526, 0x53494c5641, 0, 8, 3, '2011-08-20', 10);
INSERT INTO `totalhoras` VALUES (527, 0x414e445245204c55495a, 0, 8, 2, '2011-08-21', 11);
INSERT INTO `totalhoras` VALUES (528, 0x474f444f49, 0, 8, 2, '2011-08-21', 11);
INSERT INTO `totalhoras` VALUES (529, 0x4c5543494e4541, 0, 8, 2, '2011-08-21', 11);
INSERT INTO `totalhoras` VALUES (530, 0x4c55495a, 0, 7, 2, '2011-08-21', 11);
INSERT INTO `totalhoras` VALUES (531, 0x43414252414c, 10, 10, 0, '2011-08-06', 12);
INSERT INTO `totalhoras` VALUES (532, 0x454d4944494f, 3, 10, 0, '2011-08-06', 12);
INSERT INTO `totalhoras` VALUES (533, 0x45524e4553544f, 3, 10, 0, '2011-08-06', 12);
INSERT INTO `totalhoras` VALUES (534, 0x414c4349444553, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (535, 0x43485249535449414e, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (536, 0x434f52524541, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (537, 0x44452046524549544153, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (538, 0x44494153, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (539, 0x464142494f, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (540, 0x4a4f4e4153, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (541, 0x4a554c49414e4f2050455245495241, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (542, 0x4a554e494f52, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (543, 0x4c414954414e4f, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (544, 0x4c45414c, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (545, 0x4c45494c41, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (546, 0x4c494d4153, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (547, 0x4d415251554553, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (548, 0x4d45535155495441, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (549, 0x524f445249474f, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (550, 0x524f5349414e45, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (551, 0x5343484d495454, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (552, 0x534f555a41, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (561, 0x455a45515549454c, 0, 4, 0, '2011-08-27', 13);
INSERT INTO `totalhoras` VALUES (574, 0x5448414953, 0, 6.5, 0, '2011-08-27', 13);Para funcionar mensalmente como deseja, tem que garantir que vai existir um login por mês (e somente um) de cada usuário para que a média possa ser feita por 9.
É este o caso? Pois aparentemente o AVG ta certo. Para entender melhor oque estou dizendo faça esta query:
SELECT login, SUM(hora1) AS horat1, AVG(hora1) AS mediah1, COUNT(data) AS qtd_data_login
FROM totalhoras WHERE data BETWEEN '2011-01-01' AND '2011-09-30'
GROUP BY login
HAVING horat1 > 0
ORDER BY mediah1 ASC
Você vai ver que ele agrupa todos por login, porém se a pessoa não tiver exatos 1 login por mês o avg não vai sair como esperado, ou seja, não vai dividir por 9 e sim pela quantidade
de datas que existe do login de cada um. O ROBERTO por exemplo deve ter login duplicado ou mais de um login no mesmo mês.
Na verdade você deseja uma informação a qual sua base de dados não oferece consistência para o uso desejado dos dados.
>
Para funcionar mensalmente como deseja, tem que garantir que só vai existir um login por mês de cada usuário ou agrupar também por data.
É este o caso? Pois aparentemente o AVG ta certo.
Seria pegar todos os valores de hora que o cara fez e dividir(media) pela quantidade de meses passado no ano.
Se em Janeiro o cara fez 10 horas, Fevereiro 0 hora e Março fez uma de 10 hora e outra de 5 hora,
Somaria (10(janeiro)+0(fevereiro)+10(março)+5(março))/3, - onde o 3 é a quantidade de meses passado(janeiro, fevereiro e março).
O agrupar é pelo usuário, mesmo que tenha mais de uma escala de hora feita no mês.
Veja a query que eu fiz e você vai perceber que ele faz a média por quantidade de datas encontradas.
Se não tiver 9 datas ou se tiver 2 datas em um mesmo mês não vai dar certo.
Além de garantir que o cara tenha ao menos uma data de login por mês você também teria que agrupar
por mês para poder ter a média que quer. Só assim teria-se 9 meses por login e a divisão seria a correta.
>
Veja a query que eu fiz e você vai perceber que ele faz a média por quantidade de datas encontradas.
Se não tiver 9 datas ou se tiver 2 datas em um mesmo mês não vai dar certo.
Além de garantir que o cara tenha ao menos uma data de login por mês você também teria que agrupar
por mês para poder ter a média que quer. Só assim teria-se 9 meses por login e a divisão seria a correta.
Pois é parceiro..
Notei isso e vou mudar e passar por paramento o valor que será usado como divisor, pegando a soma total pelo sum, acho q é o melhor pela estrutura da minha base. Pq sempre vai ter um que não terá um login relacionado a data.
Vlw pela diga e ajuda.
Posta o exemplo da sua tabela com a inserção de dados amigo, para podermos testar.
Assim fica mais fácil de ajudar a fazer a query correta, pois podemos fazer testes.