select concat('<a href=./circ.php?categ=pret&form_cb=',empr_cb,'>',empr_cb,'</a>') as 'Code-barres', empr_nom as Nom, empr_prenom as Prénom, location_libelle as Localisation, CASE when (empr_sexe=1) then 'Homme' when (empr_sexe=2) then 'Femme' else 'N/A' END as Sexe from empr left join docs_location on empr_location=idlocation order by Sexe, location_libelle, empr_nom