diff --git a/src/covid19/blueprints/ecdc/ecdc_model_import.py b/src/covid19/blueprints/ecdc/ecdc_model_import.py
index 04c70daaf72b6c7151b012ff4cf4cd3979e53c81..3093fc8f20ef1dfc202ead80862223c640fad8df 100644
--- a/src/covid19/blueprints/ecdc/ecdc_model_import.py
+++ b/src/covid19/blueprints/ecdc/ecdc_model_import.py
@@ -74,15 +74,15 @@ class EcdcImport(db.Model):
             cls.country_territory_code,
             cls.pop_data_2019,
             cls.continent_exp
-        ).filter(
-            cls.continent_exp == my_continent
         ).group_by(
             cls.countries_and_sterritories,
             cls.geo_id,
             cls.country_territory_code,
             cls.pop_data_2019,
             cls.continent_exp
-        ).order_by(cls.countries_and_territories.asc()).distinct().all()
+        ).order_by(cls.countries_and_territories.asc()).filter(
+            cls.continent_exp == my_continent
+        ).distinct().all()
         #sql = """
         #select distinct
         #    countries_and_territories,