several requests with different parameters

From: "Ludger Sonntag" <LUSONNTAG(at)web(dot)de>
To: pgsql-novice(at)postgresql(dot)org
Subject: several requests with different parameters
Date: 2011-10-26 10:33:55
Message-ID: 1459765914.2883807.1319625235345.JavaMail.fmail@mwmweb010
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-novice by date

  From Date Subject
Next Message Jean-Yves F. Barbier 2011-10-26 12:06:21 Re: Debian upgrade from 9.0 to 9.1?
Previous Message Dagan 2011-10-26 08:40:03 Debian upgrade from 9.0 to 9.1?