An Error Was Encountered

Error Number: 1054

Unknown column 'labels.naam' in 'order clause'

SELECT *, fr_labels.id as labelid, (select if(sum(max_value) is null, 0, sum(max_value)) as item from fr_labels_categorie_milieu where categorie_id = '12' ) as milieu_max, (select if(sum(max_value) is null, 0, sum(max_value)) from fr_labels_categorie_sociaal where categorie_id = '12' ) as sociaal_max, 100 as controle_max, ((select if(sum(max_value) is null, 0, sum(max_value)) from fr_labels_categorie_milieu where categorie_id = '12' )+(select if(sum(max_value) is null, 0, sum(max_value)) from fr_labels_categorie_sociaal where categorie_id = '12')+100) as totaal_max, fr_labels.naam, (select if (fr_labels_sociaal_total.value is null, 0, fr_labels_sociaal_total.value) from fr_labels_sociaal_total where fr_labels_sociaal_total.categorie_id = '12' and fr_labels_sociaal_total.label_id = labelid) as sociaal, (select if (fr_labels_milieu_total.value is null, 0, fr_labels_milieu_total.value) from fr_labels_milieu_total where fr_labels_milieu_total.categorie_id = '12' and fr_labels_milieu_total.label_id = labelid) as milieu, (if (fr_labels_compleet.cs_publicatie_jaarverslag_kruisje = 'j', 5, 0) + if (fr_labels_compleet.cs_commercieel_voordeel_kruisje = 'j', 10, if (fr_labels_compleet.cs_commercieel_voordeel_kruisje = 'g', 5, 0) ) + if (fr_labels_compleet.tr_lastenboek_kruisje = 'j', 20, 0 ) + if (fr_labels_compleet.tr_betalend_kruisje = 'j', 0, 10) + if (fr_labels_compleet.cs_controleorganisatie_kruisje = 'j', 20, 0) + if (fr_labels_compleet.cs_accreditatie_kruisje = 'j', 15, 0) + if (fr_labels_compleet.cs_onafhankelijk_bedrijf_kruisje = 'j' && cs_accreditatie_kruisje != 'j', 4, 0) + if (fr_labels_compleet.cs_onafhankelijk_organisatie_kruisje = 'j' && cs_accreditatie_kruisje != 'j', 4, 0) + if (fr_labels_compleet.cs_betaalt_aanvrager_kruisje != 'j' && cs_accreditatie_kruisje != 'j', 4, 0) + if (fr_labels_compleet.cs_controle_kruisje = 'j', 5, 0) + if (fr_labels_compleet.cs_controle_jaar_jaarlijks_kruisje = 'j', 5, 0) + if (fr_labels_compleet.aanvraag_toegankelijkheid_kruisje = 'j', 5, 0) + if (fr_labels_compleet.tr_communicatie_kruisje = 'j', 5, 0) ) as controle, ( if ( (select if (fr_labels_milieu_total.value is null, 0, fr_labels_milieu_total.value) from fr_labels_milieu_total where fr_labels_milieu_total.categorie_id = '12' and fr_labels_milieu_total.label_id = labelid) is null, 0, (select if (fr_labels_milieu_total.value is null, 0, fr_labels_milieu_total.value) from fr_labels_milieu_total where fr_labels_milieu_total.categorie_id = '12' and fr_labels_milieu_total.label_id = labelid) ) + if ( (select if (fr_labels_sociaal_total.value is null, 0, fr_labels_sociaal_total.value) from fr_labels_sociaal_total where fr_labels_sociaal_total.categorie_id = '12' and fr_labels_sociaal_total.label_id = labelid) is null, 0, (select if (fr_labels_sociaal_total.value is null, 0, fr_labels_sociaal_total.value) from fr_labels_sociaal_total where fr_labels_sociaal_total.categorie_id = '12' and fr_labels_sociaal_total.label_id = labelid) ) + (if (fr_labels_compleet.cs_publicatie_jaarverslag_kruisje = 'j', 5, 0) + if (fr_labels_compleet.cs_commercieel_voordeel_kruisje = 'j', 10, if (fr_labels_compleet.cs_commercieel_voordeel_kruisje = 'g', 5, 0) ) + if (fr_labels_compleet.tr_lastenboek_kruisje = 'j', 20, 0 ) + if (fr_labels_compleet.tr_betalend_kruisje = 'j', 0, 10) + if (fr_labels_compleet.cs_controleorganisatie_kruisje = 'j', 20, 0) + if (fr_labels_compleet.cs_accreditatie_kruisje = 'j', 15, 0) + if (fr_labels_compleet.cs_onafhankelijk_bedrijf_kruisje = 'j' && cs_accreditatie_kruisje != 'j', 4, 0) + if (fr_labels_compleet.cs_onafhankelijk_organisatie_kruisje = 'j' && cs_accreditatie_kruisje != 'j', 4, 0) + if (fr_labels_compleet.cs_betaalt_aanvrager_kruisje != 'j' && cs_accreditatie_kruisje != 'j', 4, 0) + if (fr_labels_compleet.cs_controle_kruisje = 'j', 5, 0) + if (fr_labels_compleet.cs_controle_jaar_jaarlijks_kruisje = 'j', 5, 0) + if (fr_labels_compleet.aanvraag_toegankelijkheid_kruisje = 'j', 5, 0) + if (fr_labels_compleet.tr_communicatie_kruisje = 'j', 5, 0) )) as totaal FROM fr_labels LEFT JOIN fr_labels_categorie_link ON fr_labels.id = fr_labels_categorie_link.label_id LEFT JOIN fr_labels_sociaal_total ON fr_labels_sociaal_total.label_id = fr_labels.id LEFT JOIN fr_labels_milieu_total ON fr_labels_milieu_total.label_id = fr_labels.id LEFT JOIN fr_labels_compleet ON fr_labels_compleet.id = fr_labels.id WHERE fr_labels_categorie_link.categorie_id = '12' AND fr_labels.publiceren = 'j' GROUP BY fr_labels.id ORDER BY labels.naam desc