9 lines
796 B
SQL
9 lines
796 B
SQL
-- colon before variable: for a prepared statement using named placeholders, this will be a parameter name of the form :name
|
|
|
|
CREATE SCHEMA IF NOT EXISTS :schema;
|
|
SET search_path to :schema, public;
|
|
|
|
---create view
|
|
DROP VIEW IF EXISTS :schema.vw_join_gncy_rts_trps_srvcs CASCADE;
|
|
CREATE OR REPLACE VIEW :schema.vw_join_gncy_rts_trps_srvcs AS SELECT gncy_rts_trps.agency_id, gncy_rts_trps.agency_name, gncy_rts_trps.route_id, gncy_rts_trps.route_short_name, gncy_rts_trps.service_id, gncy_rts_trps.trip_id, gncy_rts_trps.trip_short_name, gncy_rts_trps.trip_headsign, srvcs.dates FROM :schema.vw_join_gncy_rts_trps AS gncy_rts_trps LEFT JOIN :schema.services AS srvcs ON gncy_rts_trps.service_id = srvcs.service_id ORDER BY gncy_rts_trps.agency_name, gncy_rts_trps.route_id, gncy_rts_trps.trip_id;
|