Debug: query = select A.id_sec, A.titulo_sec, A.target_sec,A.link_sec,A.tipo_sec,A.modo_sec from seccion as A where fkid_por=0 and ubicacion_sec='0' and tipo_sec<>'2' and publicar='1' group by 1,2,3,4,5,6,A.orden order by A.tipo_sec,cast(A.orden as numeric),A.id_sec