select codestat_libelle as 'Code statistique', origine.expl_custom_small_text as 'Origine', count(distinct expl_id) as 'Livres Imprimés : Total Unités Matérielles' from exemplaires left join notices on expl_notice=notice_id left join docs_codestat on expl_codestat=idcode left join lenders on expl_owner=idlender left join expl_custom_values as origine on (expl_id=origine.expl_custom_origine and origine.expl_custom_champ in (select idchamp from expl_custom where name="origine")) left join expl_custom_values as date on (expl_id=date.expl_custom_origine and date.expl_custom_champ in (select idchamp from expl_custom where name="date_acquisition")) left join docs_location on expl_location=idlocation where expl_location in (!!choixlocation!!) and expl_owner=!!choixproprio!! and expl_notice!=0 and typdoc='a' and niveau_biblio='m' and year(date.expl_custom_date)=!!annee!! group by 1,2 order by 1,2;
select codestat_libelle as 'Code statistique', origine.expl_custom_small_text as 'Origine', count(distinct expl_id) as 'Dont Unités Matérielles en Libre Accès (Livres Imprimés)' from exemplaires left join docs_statut on expl_statut=idstatut left join notices on expl_notice=notice_id left join docs_codestat on expl_codestat=idcode left join lenders on expl_owner=idlender left join expl_custom_values as origine on (expl_id=origine.expl_custom_origine and origine.expl_custom_champ in (select idchamp from expl_custom where name="origine")) left join expl_custom_values as date on (expl_id=date.expl_custom_origine and date.expl_custom_champ in (select idchamp from expl_custom where name="date_acquisition")) left join docs_location on expl_location=idlocation where expl_location in (!!choixlocation!!) and expl_owner=!!choixproprio!! and expl_notice!=0 and typdoc='a' and niveau_biblio='m' and year(date.expl_custom_date)=!!annee!! and pret_flag=1 group by 1,2 order by 1,2;
select codestat_libelle as 'Code statistique', origine.expl_custom_small_text as 'Origine', count(distinct notice_id) as 'Livres Imprimés : Total Titres' from exemplaires left join notices on expl_notice=notice_id left join docs_codestat on expl_codestat=idcode left join lenders on expl_owner=idlender left join expl_custom_values as origine on (expl_id=origine.expl_custom_origine and origine.expl_custom_champ in (select idchamp from expl_custom where  name="origine")) left join expl_custom_values as date on (expl_id=date.expl_custom_origine and date.expl_custom_champ in (select idchamp from expl_custom where name="date_acquisition")) left join docs_location on expl_location=idlocation where expl_location in (!!choixlocation!!) and expl_owner=!!choixproprio!! and expl_notice!=0 and typdoc='a' and niveau_biblio='m' and year(date.expl_custom_date)=!!annee!! group by 1,2 order by 1,2;
select codestat_libelle as 'Code statistique', origine.expl_custom_small_text as 'Origine', count(distinct expl_id) as 'Dont Unités Matérielles publiées avant 1811 (Livres Imprimés)' from exemplaires left join notices on expl_notice=notice_id left join docs_codestat on expl_codestat=idcode left join lenders on expl_owner=idlender left join expl_custom_values as origine on (expl_id=origine.expl_custom_origine and origine.expl_custom_champ in (select idchamp from expl_custom where name="origine")) left join expl_custom_values as date on (expl_id=date.expl_custom_origine and date.expl_custom_champ in (select idchamp from expl_custom left join docs_location on expl_location=idlocation where expl_location in (!!choixlocation!!) and name="date_acquisition")) where expl_owner=!!choixproprio!! and expl_notice!=0 and typdoc='a' and niveau_biblio='m' and year(date.expl_custom_date)=!!annee!! and year REGEXP '^[0-9]' and year NOT REGEXP '[[:alpha:]]' and year < 1811 group by 1,2 order by 1,2;
select codestat_libelle as 'Code statistique', origine.expl_custom_small_text as 'Origine', count(distinct expl_id) as 'Dont Unités Matérielles publiées entre 1811 et 1914 (Livres Imprimés)' from exemplaires left join notices on expl_notice=notice_id left join docs_codestat on expl_codestat=idcode left join lenders on expl_owner=idlender left join expl_custom_values as origine on (expl_id=origine.expl_custom_origine and origine.expl_custom_champ in (select idchamp from expl_custom where name="origine")) left join expl_custom_values as date on (expl_id=date.expl_custom_origine and date.expl_custom_champ in (select idchamp from expl_custom where name="date_acquisition")) left join docs_location on expl_location=idlocation where expl_location in (!!choixlocation!!) and expl_owner=!!choixproprio!! and expl_notice!=0 and typdoc='a' and niveau_biblio='m' and year(date.expl_custom_date)=!!annee!! and year REGEXP '^[0-9]' and year NOT REGEXP '[[:alpha:]]' and year>=1810 and year <= 1914 group by 1,2 order by 1,2;
select codestat_libelle as 'Code statistique', origine.expl_custom_small_text as 'Origine', count(distinct expl_id) as 'Publications en série imprimées : Total Unités Matérielles' from exemplaires left join bulletins on expl_bulletin=bulletin_id left join notices on bulletin_notice=notice_id left join docs_codestat on expl_codestat=idcode left join lenders on expl_owner=idlender left join expl_custom_values as origine on (expl_id=origine.expl_custom_origine and origine.expl_custom_champ in (select idchamp from expl_custom where name="origine")) left join expl_custom_values as date on (expl_id=date.expl_custom_origine and date.expl_custom_champ in (select idchamp from expl_custom where name="date_acquisition")) left join docs_location on expl_location=idlocation where expl_location in (!!choixlocation!!) and expl_owner=!!choixproprio!! and expl_bulletin!=0 and niveau_biblio='s' and year(date.expl_custom_date)=!!annee!! group by 1,2 order by 1,2;
select codestat_libelle as 'Code statistique', origine.expl_custom_small_text as 'Origine', count(distinct notice_id) as 'Publications en série imprimées : Total Titres' from exemplaires left join bulletins on expl_bulletin=bulletin_id left join notices on bulletin_notice=notice_id left join docs_codestat on expl_codestat=idcode left join lenders on expl_owner=idlender left join expl_custom_values as origine on (expl_id=origine.expl_custom_origine and origine.expl_custom_champ in (select idchamp from expl_custom where name="origine")) left join expl_custom_values as date on (expl_id=date.expl_custom_origine and date.expl_custom_champ in (select idchamp from expl_custom where name="date_acquisition")) left join docs_location on expl_location=idlocation where expl_location in (!!choixlocation!!) and expl_owner=!!choixproprio!! and expl_bulletin!=0 and niveau_biblio='s' and year(date.expl_custom_date)=!!annee!! group by 1,2 order by 1,2;