1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| SELECT Cont.NAME AS Nom
,Cont.FIRSTNAME AS Prenom
,Count(ContComp.K_CONTACT) AS Companies
,Count(ContCont.K_CONTACT2) AS Contacts
,Count(ContDocu.K_DOCUMENT) AS Documents
,Count(ContActi.K_ACTION) AS Actions
,Count(ContPubl.K_PUBLICATION) AS Publications
,Count(ContOppo.K_OPPORTUNITY) AS Opportunities
,Count(ContMail.K_MAIL) AS Mails
,Count(ContProd.K_PRODUCT) AS Products
,Count(ContProj.K_PROJECT) AS Projects
,Count(ContProf.K_PROFILE) AS Profiles
,Count(ContTmpl.K_TEMPLATE) AS Templates
FROM Actilan.adminactilan.CONTACTS Cont
LEFT JOIN CONT_COMP ContComp ON ContComp.K_CONTACT=Cont.K_CONTACT
LEFT JOIN COMPANIES Comp ON ContComp.K_COMPANY=Comp.K_COMPANY
LEFT JOIN CONT_CONT ContCont ON ContCont.K_CONTACT=Cont.K_CONTACT
LEFT JOIN DOCU_CONT ContDocu ON ContDocu.K_CONTACT=Cont.K_CONTACT
LEFT JOIN ACTI_CONT ContActi ON ContActi.K_CONTACT=Cont.K_CONTACT
LEFT JOIN PUBL_CONT ContPubl ON ContPubl.K_CONTACT=Cont.K_CONTACT
LEFT JOIN OPPO_CONT ContOppo ON ContOppo.K_CONTACT=Cont.K_CONTACT
LEFT JOIN MAIL_CONT ContMail ON ContMail.K_CONTACT=Cont.K_CONTACT
LEFT JOIN PROD_CONT ContProd ON ContProd.K_CONTACT=Cont.K_CONTACT
LEFT JOIN PROJ_CONT ContProj ON ContProj.K_CONTACT=Cont.K_CONTACT
LEFT JOIN PROF_CONT ContProf ON ContProf.K_CONTACT=Cont.K_CONTACT
LEFT JOIN TMPL_CONT ContTmpl ON ContTmpl.K_CONTACT=Cont.K_CONTACT
WHERE Comp.KIND=12
GROUP BY Cont.NAME, Cont.FIRSTNAME
ORDER BY Cont.NAME, Cont.FIRSTNAME |
Partager