fixed the result_country definition

This commit is contained in:
Antonis Lempesis 2024-01-08 16:01:26 +02:00
parent 6b823100ae
commit 2e4cab026c
1 changed files with 7 additions and 3 deletions

View File

@ -1210,6 +1210,10 @@ where ri.license is not null and datasource.type like '%Repository%' and datasou
on p.id= tmp.id; on p.id= tmp.id;
create table ${stats_db_name}.result_country stored as parquet as create table ${stats_db_name}.result_country stored as parquet as
select distinct ro.id, o.country from ${stats_db_name}.result_organization ro select distinct ro.id, coalesce(o.country, f.country)
join ${stats_db_name}.organization o on o.id=ro.organization from ${stats_db_name}.result_organization ro
join ${stats_db_name}.funder f on f.country=o.country; left outer join ${stats_db_name}.organization o on o.id=ro.organization
left outer join ${stats_db_name}.result_projects rp on rp.id=ro.id
left outer join ${stats_db_name}.project p on p.id=rp.project
left outer join ${stats_db_name}.funder f on f.name=p.funder
where coalesce(o.country, f.country) IS NOT NULL;