GALERIA DE FOTOS

Expression #1 of ORDER BY clause is not in SELECT list, references column 'especial_especializacao.tb_foto.ordem' which is not in SELECT list; this is incompatible with DISTINCT
SELECT DISTINCT(`escola`) FROM `tb_foto` WHERE `ativo` = 'S' ORDER BY `ordem` ASC;