SELECT annonces.id, annonces.id_categorie_web_new, annonces.date_publication, annonces.date_publication, annonces.titre, annonces.description, annonces.lat, annonces.lon, annonces.telephone, annonces.telephone2, annonces.hide_phone, communes_france.nom AS ville, communes_france.nom_maj AS ville_maj, communes_france.cp, communes_france.ci AS insee, communes_france.id AS ville_id, clients.id AS client_id, (SELECT COUNT(*) FROM annonces WHERE annonces.id_client = client_id AND annonces.etat = 'O' AND annonces.id_categorie_web_new NOT IN (68,69) AND date_publication <= NOW() AND annonces.display_web = 'O') AS nb_annonces_client, clients.pseudo, clients.statut, clients.pro, clients.photo AS photoProfil, clients.etat_photo, `1_categories`.id AS idCat, `1_categories`.libelle, `1_categories`.slug, CONCAT('[', GROUP_CONCAT(DISTINCT IF(photos_annonce.id IS NOT NULL, JSON_OBJECT('id', photos_annonce.id, 'compteur', photos_annonce.compteur, 'photo', photos_annonce.photo, 'etat', photos_annonce.etat), null) ORDER BY photos_annonce.compteur DESC), ']') AS photos, CONCAT('[', GROUP_CONCAT(DISTINCT IF(`1_criteres`.id IS NOT NULL, JSON_OBJECT('id', `1_criteres`.id, 'valeur', IF(`1_annonces_criteres`.value != '', `1_annonces_criteres`.value, `1_criteres_categories_options`.labelOption), 'type', `1_criteres`.type, 'format_display', `1_criteres`.format_display, 'nom', `1_criteres`.label, 'unite', `1_criteres`.unit, 'ordre', `1_criteres_categories`.ordre), null) ORDER BY `1_criteres_categories`.ordre), ']') AS criteres_data FROM annonces LEFT JOIN communes_france ON communes_france.id = annonces.ville LEFT JOIN clients ON clients.id = annonces.id_client LEFT JOIN photos_annonce ON photos_annonce.annonce = annonces.id AND photos_annonce.etat = 'O' JOIN `1_categories` ON `1_categories`.id = annonces.id_categorie_web_new LEFT JOIN `1_annonces_criteres` ON `1_annonces_criteres`.id_annonce = annonces.id LEFT JOIN `1_criteres` ON `1_criteres`.id = `1_annonces_criteres`.id_criteres LEFT JOIN `1_criteres_categories` ON `1_criteres_categories`.id_critere = `1_criteres`.id AND `1_criteres_categories`.id_categorie = `1_categories`.id LEFT JOIN `1_criteres_categories_options` ON `1_criteres_categories_options`.id = `1_annonces_criteres`.id_criteres_categories_options WHERE annonces.etat = 'O' AND annonces.statut <> 'SPAM' AND annonces.date_publication <= NOW() AND annonces.display_web = 'O' AND titre != '' AND annonces.id = :id GROUP BY annonces.id