| From: | colin roald <zmook(at)gungeralv(dot)org> |
|---|---|
| To: | pgsql-admin(at)postgresql(dot)org |
| Subject: | Re: SQL-Statement |
| Date: | 2003-09-16 20:04:29 |
| Message-ID: | 20030916200429.GF3848@moonbase.hopto.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-admin |
Quoth Markus Espenhain <espenhain(at)etes(dot)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)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | scott.marlowe | 2003-09-16 20:49:53 | Re: File Sytems Types and Os Recomendations |
| Previous Message | John Allgood | 2003-09-16 18:15:59 | File Sytems Types and Os Recomendations |