SELECT * FROM `bien` JOIN `agence` ON `agence`.`id_agence` = `bien`.`id_agence` WHERE `agence`.`etat` = 1 AND `bien`.`etat` = 1 AND ((`bien`.`duplicate` =0 and ( `bien`.export_dup=0 or export_dup=2 or `bien`.export_dup is null)) or `bien`.`duplicate` !=0 ) and statut!=3 and statut!=5 and statut!=4 AND (bien.`id_agence` = '122' or (bien.id_agence='36' and id_bien not in (select id_origine_duplicate from bien where id_agence='122' and id_origine_duplicate is not null) and id_bien in (select id_bien from bien where ROUND(6371 * acos(cos(radians('46.3733599')) * cos(radians(latitude)) * cos(radians(longitude) - radians('2.4771905')) + sin(radians('46.3733599')) * sin(radians(latitude)))) <=20))) and (type_offre=0 or statut=6) order by save_date desc LIMIT :premier, :parpage;