  	a.federal_states, 
  	a.elec_consumption_industry/b.gva_industry AS elec_consumption_industry, 
  	a.elec_consumption_tertiary_sector/b.gva_tertiary_sector AS elec_consumption_tertiary_sector 
-FROM  	demand.lak_consumption_per_federalstate a,  -- ego_demand_federalstate
- 	economic.destatis_gva_per_districts b -- destatis_gva_per_district
+FROM  	demand.ego_demand_federalstate a,  -- ego_demand_federalstate
+ 	economic.destatis_gva_per_district b -- destatis_gva_per_district
 WHERE a.eu_code = b.eu_code 
 ORDER BY eu_code 
 ) 

INSERT INTO	model_draft.ego_scenario_log (version,io,schema_name,table_name,script_name,entries,status,user_name,timestamp,metadata)
SELECT	'0.2.1' AS version,
	'input' AS io,
	'orig_geo_powerplants' AS schema_name,
	'proc_power_plant_germany' AS table_name,
	'process_eGo_osm_loads_industry.sql' AS script_name,
	COUNT(*)AS entries,
	'OK' AS status,
	session_user AS user_name,
	NOW() AT TIME ZONE 'Europe/Berlin' AS timestamp,
	obj_description('orig_geo_powerplants.proc_power_plant_germany' ::regclass) ::json AS metadata
FROM	orig_geo_powerplants.proc_power_plant_germany;

DROP TABLE IF EXISTS model_draft.ego_demand_hv_largescaleconsumer CASCADE;
CREATE TABLE model_draft.ego_demand_hv_largescaleconsumer AS

a.elec_consumption_industry * b.gva_industry as elec_consumption_industry, 
a.elec_consumption_tertiary_sector * b.gva_tertiary_sector AS elec_consumption_tertiary_sector 
FROM  	model_draft.ego_demand_per_gva a, 
 	economic.destatis_gva_per_district b -- destatis_gva_per_district
WHERE SUBSTR (a.eu_code,1,3) = SUBSTR(b.eu_code,1,3)  
) 
; 
