Re: Is this possible or am I on drugs :) - Mailing list pgsql-general

From shawn everett
Subject Re: Is this possible or am I on drugs :)
Date
Msg-id Pine.LNX.4.30.0011272223390.7005-100000@alder.pgweb.com
Whole thread Raw
In response to Re: Is this possible or am I on drugs :)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Is this possible or am I on drugs :)
Re: Is this possible or am I on drugs :)
List pgsql-general
> What do you consider "passing a parameter to the view" to be?
>
This is where Microsoft Access has twisted me :)

Access as you may or may not know allows you to use parameters in a query:

SELECT * FROM table WHERE table.pkey=[Enter The Primary Key];

The bit in [] represents a prompt to the user.  They can also be filled in
programatically.

The basic select statement for my problem is going to work as follows:

select colA, colB, colA+colB*0.4 as f1, colC, colC+colD*9 as f2 from table
where date=SomeDateEnteredByTheUser;

Can I pass SomeDateEnteredByTheUser to Postgres in some way and get back
the set of records I want?  If I can is there a way to call this from PHP?

If I can't and end up dynamically writing the query and sumbitting that
to Postgres is this a smart way to do it?

Or should I simply query out the basic values: colA, colB, colC and colD
and then do the calculations within PHP?

Shawn



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Is this possible or am I on drugs :)
Next
From: Tod McQuillin
Date:
Subject: Re: Is this possible or am I on drugs :)