From: colin roald <zmook@gungeralv.org>
To: pgsql-admin@postgresql.org
Subject: Re: SQL-Statement
Date: Tue, 16 Sep 2003 16:04:29 -0400
Message-ID: <20030916200429.GF3848@moonbase.hopto.org> (raw)
In-Reply-To: <20030916115454.GA2115@intranet.etes.de>
References: <20030916115454.GA2115@intranet.etes.de>
Quoth Markus Espenhain <espenhain@etes.de>:
> SELECT * FROM Hauptantrag WHERE (select datenfeldname from
> datenexport) > (select datum_von from datenexport) AND (select
> datenfeldname from datenexport) < (select datenexport.datum_bis from
> datenexport) limit 10;
If I understand you right, you want to compare some column from
Hauptantrag to a range of values (datum_bis < 'some column' < datum_von),
but you don't know what the column will be ahead of time.
I believe this requires a dynamic sql statement, such as the plpython
command 'execute':
rv = plpy.execute(
"SELECT * FROM Hauptantrag WHERE %s > %f AND %s < %f"
% (colname, datum_von, datum_bis),
10)
If you can, it's probably best to rework the logic of your code to
avoid having to test unknown columns.
--
colin | perfection is reached, not when there is no longer anything to add,
roald | but when there is no longer anything to take away.
(antoine de saint-exupery)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: zmook@gungeralv.org
Subject: Re: SQL-Statement
In-Reply-To: <20030916200429.GF3848@moonbase.hopto.org>
References: <20030916115454.GA2115@intranet.etes.de> <20030916200429.GF3848@moonbase.hopto.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox