Código SQL:
Ver originalCREATE TABLE `horarios` (
`grado` INT(11) NOT NULL,
`cod_mat` INT(3) NOT NULL,
`seccion` VARCHAR(5) COLLATE utf8_spanish_ci NOT NULL,
`cod_mencion` VARCHAR(10) COLLATE utf8_spanish_ci NOT NULL,
`cod_doc` INT(11) NOT NULL,
`dia1` INT(11) NOT NULL,
`dish1` VARCHAR(15) COLLATE utf8_spanish_ci NOT NULL,
`aula1` VARCHAR(10) COLLATE utf8_spanish_ci NOT NULL,
`dia2` INT(11) NOT NULL,
`dish2` VARCHAR(15) COLLATE utf8_spanish_ci NOT NULL,
`aula2` VARCHAR(10) COLLATE utf8_spanish_ci NOT NULL,
`dia3` INT(11) NOT NULL,
`dish3` VARCHAR(15) COLLATE utf8_spanish_ci NOT NULL,
`aula3` VARCHAR(10) COLLATE utf8_spanish_ci NOT NULL,
`dia4` INT(11) NOT NULL,
`dish4` VARCHAR(15) COLLATE utf8_spanish_ci NOT NULL,
`aula4` VARCHAR(10) COLLATE utf8_spanish_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
INSERT INTO `horarios` (`grado`, `cod_mat`, `seccion`, `cod_mencion`, `cod_doc`, `dia1`, `dish1`, `aula1`, `dia2`, `dish2`, `aula2`, `dia3`, `dish3`, `aula3`, `dia4`, `dish4`, `aula4`) VALUES (8,16,'A','',2,1,'01-02-03-04','',0,'---','',0,'---','',0,'---',''),(8,16,'B','',2,1,'05-06-07-08','',0,'---','',0,'---','',0,'---',''),(8,21,'A','',2,2,'01-02-03-04','2',4,'01-02-03-04','3',0,'---','',0,'---',''),(8,21,'B','',2,3,'01-02-03-04','3',5,'12-13-14-15','3',0,'---','',0,'---',''),(9,28,'C','',38,1,'01-02-03-04','5',0,'---','',0,'---','',0,'---',''),(9,25,'C','',42,2,'01-02-03-04','6',0,'---','',0,'---','',0,'---',''),(9,34,'C','',29,1,'05-06-07-08','3',3,'10-11-12-13','3',0,'---','',0,'---',''),(9,33,'C','',18,3,'01-02-03-04','4',5,'01-02-03-04','4',0,'---','',0,'---',''),(9,31,'C','',40,4,'01-02-03-04','7',0,'---','',0,'---','',0,'---','');
lo q quisiera es poder contar las horas q tiene el docente registrada en horarios ya sean en los campos dish1,dish2,dish3 y dish4