Re: Help with multistage query

From: "Russell Simpkins" <russellsimpkins(at)hotmail(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Help with multistage query
Date: 2005-09-07 20:05:05
Message-ID: BAY103-DAV13C36CCE265B28F7F39B50B5A60@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


I have a perl script that issues a series of SQL statements to perform some queries. The script works, but I believe there must be a more elegant way to do this.

The simplified queries look like this:

SELECT id FROM t1 WHERE condition1; ;returns about 2k records which are stored in @idarray

foreach $id (@idarray) {

SELECT x FROM t2 WHERE id=$id; ; each select returns about 100 records which are saved in a perl variable

}

how about
select t1.id from t1, t2 where t1.id = t2.id and t2.id = x

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message mark 2005-09-07 20:10:17 Re: uuid type for postgres
Previous Message Tom Lane 2005-09-07 19:45:31 Re: uuid type for postgres