 --
 
 CREATE VIEW readings_before_install AS
-    SELECT "MeterLocationHistory".meter_name, "MeterLocationHistory".old_service_point_id AS service_point_id, "MeterLocationHistory".service_point_latitude, "MeterLocationHistory".service_point_longitude, "MeterLocationHistory".location, "MeterLocationHistory".address, "MeterLocationHistory".latitude, "MeterLocationHistory".longitude, "MeterLocationHistory".installed, "MeterLocationHistory".uninstalled, "Reading".channel, "Reading".raw_value, "Reading".value, "Reading".uom, "Interval".end_time, "MeterData".meter_data_id FROM (((("MeterLocationHistory" JOIN "MeterData" ON ((("MeterLocationHistory".meter_name)::bpchar = "MeterData".meter_name))) JOIN "IntervalReadData" ON (("MeterData".meter_data_id = "IntervalReadData".meter_data_id))) JOIN "Interval" ON (("IntervalReadData".interval_read_data_id = "Interval".interval_read_data_id))) JOIN "Reading" ON ((("Interval".interval_id = "Reading".interval_id) AND ("Interval".end_time < "MeterLocationHistory".installed))));
+    SELECT "MeterLocationHistory".meter_name, "MeterLocationHistory".service_point_id, "MeterLocationHistory".service_point_latitude, "MeterLocationHistory".service_point_longitude, "MeterLocationHistory".location, "MeterLocationHistory".address, "MeterLocationHistory".latitude, "MeterLocationHistory".longitude, "MeterLocationHistory".installed, "MeterLocationHistory".uninstalled, "Reading".channel, "Reading".raw_value, "Reading".value, "Reading".uom, "Interval".end_time, "MeterData".meter_data_id FROM (((("MeterLocationHistory" JOIN "MeterData" ON ((("MeterLocationHistory".meter_name)::bpchar = "MeterData".meter_name))) JOIN "IntervalReadData" ON (("MeterData".meter_data_id = "IntervalReadData".meter_data_id))) JOIN "Interval" ON (("IntervalReadData".interval_read_data_id = "Interval".interval_read_data_id))) JOIN "Reading" ON ((("Interval".interval_id = "Reading".interval_id) AND ("Interval".end_time < "MeterLocationHistory".installed))));
 
 
 ALTER TABLE public.readings_before_install OWNER TO postgres;



--
-- Name: Reading; Type: ACL; Schema: public; Owner: sepgroup
--


ALTER TABLE public."_IrradianceFifteenMinIntervals" OWNER TO postgres;

--
-- Name: az_ashkan1; Type: VIEW; Schema: public; Owner: christian
--

CREATE VIEW az_ashkan1 AS
    SELECT DISTINCT avg("IrradianceData".irradiance_w_per_m2) AS "irradiance w/m2", date_trunc('hour'::text, "IrradianceData"."timestamp") AS "time hr", avg("KiheiSCADATemperatureHumidity".met_air_temp_degf) AS temperature, avg("KiheiSCADATemperatureHumidity".met_rel_humid_pct) AS "humidity pct" FROM ("IrradianceData" JOIN "KiheiSCADATemperatureHumidity" ON (("IrradianceData"."timestamp" = "KiheiSCADATemperatureHumidity"."timestamp"))) GROUP BY "IrradianceData"."timestamp" ORDER BY date_trunc('hour'::text, "IrradianceData"."timestamp") LIMIT 1000;


ALTER TABLE public.az_ashkan1 OWNER TO christian;

--
-- Name: az_houses_all_with_smart_meter; Type: VIEW; Schema: public; Owner: eileen
--

CREATE VIEW az_houses_all_with_smart_meter AS
    SELECT "MeterLocationHistory".address, "MeterLocationHistory".service_point_id, "MeterLocationHistory".service_point_id AS new_service_point_id FROM "MeterLocationHistory" WHERE ("MeterLocationHistory".uninstalled IS NULL);


ALTER TABLE public.az_houses_all_with_smart_meter OWNER TO eileen;
