gtfs/sql/join-gncy-rts.sql

9 lines
531 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 CASCADE;
CREATE OR REPLACE VIEW :schema.vw_join_gncy_rts AS SELECT gncy.agency_id, gncy.agency_name, rts.route_id, rts.route_short_name FROM :schema.agency AS gncy LEFT JOIN :schema.routes AS rts ON rts.agency_id = gncy.agency_id ORDER BY gncy.agency_name, rts.route_id;