added cirulation view
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Dec 2005 19:10:32 +0000 (19:10 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Dec 2005 19:10:32 +0000 (19:10 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2537 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/sql/Pg/090.schema.action.sql

index cab9cd8..f83c605 100644 (file)
@@ -90,6 +90,21 @@ CREATE OR REPLACE VIEW action.billable_cirulations AS
          FROM  action.circulation
          WHERE xact_finish IS NULL;
 
+CREATE VIEW stats.fleshed_circulation AS
+        SELECT  c.*,
+                CAST(c.xact_start AS DATE) AS start_date_day,
+                CAST(c.xact_finish AS DATE) AS finish_date_day,
+                DATE_TRUNC('hour', c.xact_start) AS start_date_hour,
+                DATE_TRUNC('hour', c.xact_finish) AS finish_date_hour,
+                cp.call_number_label,
+                cp.owning_lib,
+                cp.item_lang,
+                cp.item_type,
+                cp.item_form
+        FROM    "action".circulation c
+                JOIN stats.fleshed_copy cp ON (cp.id = c.target_copy);
+
+
 CREATE OR REPLACE FUNCTION action.circulation_claims_returned () RETURNS TRIGGER AS $$
 BEGIN
        IF OLD.stop_fines IS NULL OR OLD.stop_fines <> NEW.stop_fines THEN