 		FROM
 			model_draft."ego_grid_mvlv_substation" AS onts 
 			INNER JOIN 
-			model_draft."ego_grid_lv_cut" AS regions ON onts.load_area_id = regions.load_area_id
+			model_draft."ego_grid_lv_griddistrict" AS regions ON onts.load_area_id = regions.load_area_id
 			INNER JOIN 
-			model_draft."ego_grid_lv_cut" AS regions2 ON ST_INTERSECTS(regions.geom,regions2.geom)
+			model_draft."ego_grid_lv_griddistrict" AS regions2 ON ST_INTERSECTS(regions.geom,regions2.geom)
 		WHERE ST_CONTAINS (regions2.geom,onts.geom)
 		GROUP BY regions_id
 

----- Delete auxilliary tables

DROP TABLE IF EXISTS model_draft."ego_grid_lv_griddistrictsvoronoi";
DROP TABLE IF EXISTS model_draft."ego_grid_lv_cut";
DROP TABLE IF EXISTS model_draft."ego_grid_lv_griddistrictwithoutpop";
DROP TABLE IF EXISTS model_draft."ego_grid_lv_griddistrictsectors";


  ont_count integer,
  ont_id integer,
  merge_id integer,
  CONSTRAINT ego_grid_lv_griddistrict_pkey2 PRIMARY KEY (id)
);

 
TRUNCATE TABLE 	model_draft."ego_grid_lv_griddistrict";
INSERT INTO		model_draft.ego_grid_lv_griddistrict (geom,load_area_id)
	SELECT	(ST_DUMP(ST_INTERSECTION(mun.geom,voi.geom))).geom ::geometry(Polygon,3035) AS geom, mun.id AS load_area_id
	FROM	model_draft."ego_demand_loadarea" AS mun,
		model_draft."ego_grid_lv_griddistrictsvoronoi" AS voi
