From: | "David Parker" <dparker(at)tazznetworks(dot)com> |
---|---|
To: | "Robert Fitzpatrick" <robert(at)webtent(dot)com>, "PostgreSQL" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: SELECT based on function result |
Date: | 2004-07-15 20:37:04 |
Message-ID: | 120DB10316D2B946A3A1BEFB82324BB18594AD@kodos.tazznetworks.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Did you try creating a view with that select statement, then just
selecting from the view? I don't know if there is a restriction on using
a function like that in a view definition or not.
-DAP
-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Robert
Fitzpatrick
Sent: Thursday, July 15, 2004 4:31 PM
To: PostgreSQL
Subject: [GENERAL] SELECT based on function result
I have a function that tells me if a record is positive and negative
based on several field values. I use it in select statements:
ohc=> SELECT sample_id, is_wipe_positive(tblleadwipe.sample_id) AS
positive FROM tblleadwipe WHERE hud_building_id IS NOT NULL; sample_id
| positive
-----------+----------
73 | f
81 | t
(2 rows)
I see that I cannot change my WHERE statement to WHERE positive = 't'
because the column positive does not exist. Now I am looking for the
best way to return all records that are found positive or negative using
a query. Can anyone offer any guidance to how I can return all the
positives (or negatvies)? Or do I need to write another function that
does that?
--
Robert
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if
your
joining column's datatypes do not match
From | Date | Subject | |
---|---|---|---|
Next Message | David Parker | 2004-07-15 20:44:16 | Re: moving an installation |
Previous Message | Robert Fitzpatrick | 2004-07-15 20:30:38 | SELECT based on function result |