Useful Queries - POSOCO/wrldc_warehouse_data_migration_python GitHub Wiki

extract state sector forced outages for a time window

select id, entity_id, element_id, elementname, outage_date, outage_time, revived_date, revived_time, outage_remarks from REPORTING_WEB_UI_UAT.real_time_outage 
where entity_id=8 and 
outage_date between '01-10-2019' and '31-10-2019' and 
element_id in (
select gu.id 
from REPORTING_WEB_UI_UAT.generating_unit gu 
LEFT join REPORTING_WEB_UI_UAT.generating_station gs on gs.id= gu.fk_generating_station
where gs.classification_id in (1,2)
)
order by outage_date,elementname