several requests with different parameters - Mailing list pgsql-novice

From Ludger Sonntag
Subject several requests with different parameters
Date
Msg-id 1459765914.2883807.1319625235345.JavaMail.fmail@mwmweb010
Whole thread Raw
List pgsql-novice
Hi all,


I'd like to run the following steps automatically and, if possible, in one step. But I don't know how.

Step 1:


CREATE TABLE table_1 AS
SELECT *
   FROM vertices_tmp
   JOIN
   (SELECT * FROM driving_distance('
      SELECT ogc_fid AS id,
          source::int4 AS source,
          target::int4 AS target,
          traveltime::float8 AS cost
      FROM strassenl_dachraum_erweitert_ohne_autobahn',
      25080,
      60,
      false,
      false)) AS route
   ON
   vertices_tmp.id = route.vertex_id

Step 1 has to run 500 times with different values for the 5 digit number (here 25080) and a changing table name (table_
+ascending number). The 5 digit number is received from another table (vertices_tmp). 


Step 2:

Schritt 2:
CREATE TABLE catchment_union AS
SELECT id,the_geom,cost FROM table_1
UNION ALL
SELECT id,the_geom,cost FROM table_2
UNION ALL
SELECT id,the_geom,cost FROM table_3
...
...

In step 2 the tables received in step 1 are merged with UNION.
How can I do that automatically?

I am grateful for any help.

Cheers,
Lu
___________________________________________________________
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192

pgsql-novice by date:

Previous
From: Dagan
Date:
Subject: Debian upgrade from 9.0 to 9.1?
Next
From: "Jean-Yves F. Barbier"
Date:
Subject: Re: Debian upgrade from 9.0 to 9.1?