SELECT annonces.id, annonces.date_publication, annonces.titre, communes_france.nom AS ville, communes_france.cp, clients.statut, photos_annonce.photo, photos_annonce.etat AS etatPhoto, `1_categories`.slug AS categorie, `1_categories`.id AS idCat, GROUP_CONCAT(upsells.slug) AS optionsWeb, CONCAT( '[', GROUP_CONCAT( DISTINCT IF( `1_criteres`.id IS NOT NULL, JSON_OBJECT( 'valeur', IF(`1_annonces_criteres`.value != '', `1_annonces_criteres`.value, `1_criteres_categories_options`.labelOption), 'nom', `1_criteres`.label, 'unite', `1_criteres`.unit, 'ordre', `1_criteres_categories`.ordre, 'format_display', `1_criteres`.format_display ), NULL ) ORDER BY `1_criteres_categories`.ordre ), ']' ) AS criteres_data, IF(`crit`.type = 'price', `crit`.value, 0) AS prix FROM annonces JOIN communes_france ON communes_france.id = annonces.ville JOIN departements ON departements.code_dep = communes_france.departement JOIN `1_categories` ON `1_categories`.id = annonces.id_categorie_web_new LEFT JOIN clients ON clients.id = annonces.id_client LEFT JOIN photos_annonce ON photos_annonce.annonce = annonces.id AND photos_annonce.etat = 'O' AND photos_annonce.compteur = 0 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 ( SELECT 1_criteres.id, 1_criteres.type, 1_annonces_criteres.value, 1_annonces_criteres.id_annonce FROM 1_criteres JOIN 1_annonces_criteres ON 1_criteres.id = 1_annonces_criteres.id_criteres WHERE type='price' ) as crit ON `crit`.id_annonce = `annonces`.id 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 LEFT JOIN commandes_annonces ON commandes_annonces.id_annonce = annonces.id LEFT JOIN commandes ON commandes.id = commandes_annonces.id_commande LEFT JOIN commandes_options_web ON commandes_options_web.id_commande_annonce = commandes_annonces.id LEFT JOIN upsell_options ON upsell_options.id = commandes_options_web.id_option LEFT JOIN upsells ON upsells.id = upsell_options.upsell WHERE annonces.etat = 'O' AND annonces.statut <> 'SPAM' AND annonces.date_publication <= NOW() AND annonces.display_web = 'O' AND titre != '' AND commandes.etat = 'O' AND annonces.id_categorie_web_new = 41 GROUP BY annonces.id ORDER BY annonces.date_publication DESC, annonces.id DESC LIMIT 16, 16