 
 
 --
+-- Name: count_of_register_duplicates; Type: VIEW; Schema: public; Owner: daniel
+--
+
+CREATE VIEW count_of_register_duplicates AS
+    SELECT "Register".number, "MeterData".meter_name, "RegisterRead".read_time, (count(*) - 1) AS "Duplicate Count" FROM (((("MeterData" JOIN "RegisterData" ON (("MeterData".meter_data_id = "RegisterData".meter_data_id))) JOIN "RegisterRead" ON (("RegisterData".register_data_id = "RegisterRead".register_data_id))) JOIN "Tier" ON (("RegisterRead".register_read_id = "Tier".register_read_id))) JOIN "Register" ON (("Tier".tier_id = "Register".tier_id))) GROUP BY "Register".number, "MeterData".meter_name, "RegisterRead".read_time HAVING ((count(*) - 1) > 0) ORDER BY "RegisterRead".read_time DESC, (count(*) - 1) DESC;
+
+
+ALTER TABLE public.count_of_register_duplicates OWNER TO daniel;
+
+--
+-- Name: VIEW count_of_register_duplicates; Type: COMMENT; Schema: public; Owner: daniel
+--
+
+COMMENT ON VIEW count_of_register_duplicates IS 'Count of duplicates in the Register branch. @author Daniel Zhang (張道博)';
+
+
+--
 -- Name: meter_ids_for_houses_without_pv_with_locations; Type: VIEW; Schema: public; Owner: postgres
 --
 



--
-- Name: voltage_locations_highlow_events; Type: VIEW; Schema: public; Owner: postgres
--




--
-- Name: view_register_records; Type: ACL; Schema: public; Owner: daniel
--

REVOKE ALL ON TABLE view_register_records FROM PUBLIC;
REVOKE ALL ON TABLE view_register_records FROM daniel;
GRANT ALL ON TABLE view_register_records TO daniel;
GRANT ALL ON TABLE view_register_records TO sepgroup;


--
-- Name: voltage_locations_highlow_events; Type: ACL; Schema: public; Owner: postgres
--

