// + " IF(IF(IFNULL(tab_eva.exa,'') = '',0,1)+IF(IFNULL(tab_eva.not_enc,'') = '',0,1)=2,2,IF(IFNULL(tab_eva.exa,'') <> '' OR IFNULL(tab_eva.not_enc,'') <> '' OR IFNULL(TABLA.nom_zon,'') <> '',1,0))) AS orden2\n"
// + " FROM (\n"
// + " SELECT\n"
// + " dt.cod_doc,\n"
// + " dt.apellido_doc,\n"
// + " dt.nombre_doc,\n"
// + " IF(z.nom_zon IS NULL,0,1) as orderZona,\n"
// + " IF(z.nom_zon IS NULL,'',z.nom_zon) as nom_zon \n"
// + " FROM\n"
// + " docente_temporal AS dt\n"
// + " LEFT JOIN zona_docente AS zd ON zd.cod_doc = dt.cod_doc\n"
// + " LEFT JOIN zona_sede AS zs ON zs.cod_zon = zd.cod_zon AND zs.cod_loc IN (SELECT aula.codlocal FROM aula WHERE codaula IN (25))\n"
// + " LEFT JOIN zona AS z ON z.cod_zon = zs.cod_zon\n"
// + " ) TABLA\n"
// + " LEFT JOIN tabla_evaluacion AS tab_eva ON tab_eva.cod_doc = TABLA.cod_doc AND tab_eva.cod_per_gen = (SELECT cod_per_gen FROM periodo_academico WHERE cod_per = '21') \n"
// + " GROUP BY TABLA.cod_doc \n"
// + " ORDER BY orden2 DESC\n"
// + " ) TABLA2\n"
// + " mez GROUP BY TABLA2.cod_doc \n"
// + "ORDER BY promedio desc,ordenCantidad DESC, orden3 DESC";