-- DROP TABLE t_busstop; CREATE TABLE t_busstop (gid SERIAL PRIMARY KEY,name text,fixed integer,area integer,geom GEOMETRY(POINT, 4612)); CREATE INDEX ix_busstop_geom ON t_busstop USING GiST (geom); -- DROP VIEW public."V_14kanagawa_busstop"; CREATE OR REPLACE VIEW public."V_14kanagawa_busstop" AS SELECT admarea.gid, (( SELECT fixed FROM t_busstop WHERE st_within(t_busstop.geom, admarea.geom)))::integer AS stncnt, admarea.geom, admarea.n03_004 AS name FROM admarea; -- DROP VIEW public."V_busstop_0"; CREATE OR REPLACE VIEW public."V_busstop_0" AS SELECT gid,name,fixed,area,geom FROM t_busstop WHERE fixed=0; CREATE OR REPLACE VIEW public."V_busstop_1" AS SELECT gid,name,fixed,area,geom FROM t_busstop WHERE fixed>0; SELECT t_busstop.gid, t_busstop.geom FROM t_busstop,admarea WHERE st_within(rail.c_geom, admarea.geom); ALTER TABLE public."V_kanagawa" OWNER TO yuu;