1 2 3 4 5 6 7 8 9 10 11 12
|
select coalesce(libelle,'') as chatri, vue.trigramme as trigramme_dest,vue.id as id_dest,vue.trigramme,vue.id,vue.id_type_objet,1 as nbre_dest,vue.[cle],vue.[id_utilisateur],[id_suivi],vue.[dcr],vue.[dmo],adresse_direct,[adresse_long],[adresse_court],[geo_latitude],[geo_longitude],[geo_matchcode],[geo_confidence],[email],[emadir],[telephone],[teldir],[mobile],[mobdir],[site],[sitedir],[nbre_envoi],[nbre_vue],[nbre_click],[taux_vue],[taux_click],[taux_reactivite],derniere_date_vue,derniere_date_click,coalesce(vue.[libelle],'') as libelle,[isole],[fonction],[id_str],[id_con],[list_id_rappel_detail_element],ext_photo_str,ext_photo_con,0 as doublon,groupe_dcr
from (select * from (select vue.*,list_id_rappel_detail_element from (select * from fnc_moteur_recherche_str_sans()
UNION ALL
select * from fnc_moteur_recherche_con_sans()
UNION ALL
select * from fnc_moteur_recherche_stc_sans()) as vue LEFT OUTER JOIN vue_rappel_detail2 ON vue.id=vue_rappel_detail2.id and vue.id_type_objet=vue_rappel_detail2.id_type_objet) as vue) as vue INNER JOIN (select vue.id,vue.id_type_objet from (select * from (select * from fnc_moteur_recherche_str_sans()
UNION ALL
select * from fnc_moteur_recherche_con_sans()
UNION ALL
select * from fnc_moteur_recherche_stc_sans()) as vue) as vue INNER JOIN (select distinct id,id_type_objet from (select vue.id,vue.id_type_objet from (select id_structure as id,1 as id_type_objet from structures UNION ALL select id_contact as id,2 as id_type_objet from contact UNION ALL select id_strcon as id,3 as id_type_objet from structures_contact) as vue LEFT OUTER JOIN (select * from vue_champ_valeur_liste_multiple where id_champ_objet=31) as chpval ON vue.id=chpval.id AND vue.id_type_objet=chpval.id_type_objet where not chpval.id is null) as vue) as vueinner1 ON vue.id=vueinner1.id AND vue.id_type_objet=vueinner1.id_type_objet) as filtre ON vue.id=filtre.id and vue.id_type_objet=filtre.id_type_objet where ((vue.id_type_objet=3) or (vue.id_type_objet=2 and isole=1) or (vue.id_type_objet=1))
order by chatri |
Partager