Re: Usage of function retruning record in query

From: gmb <gmbouwer(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Usage of function retruning record in query
Date: 2011-07-04 13:59:49
Message-ID: 1309787989162-4550092.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Harald Fuchs-10 wrote:
> In article <1309762075448-4549140(dot)post(at)n5(dot)nabble(dot)com>,gmb
> &lt;gmbouwer(at)gmail(dot)com&gt; writes:
> SELECT itemid, (calcvalues(itemid)).* FROM itemlist
>

Thanks for the feedback, Harald.

How about specifying different aliases to the resulting values?
This will be handy when I use the same function multiple times in the same
query.
(the function will take another input parameters used in the calculations)

E.g.:
SELECT itemid, (calcvalues(itemid, '2011-06-06')).*, (calcvalues(itemid,
'2011-06-07')).* FROM itemlist;

itemid | calcval1 | calcval2 | calcval1 | calcval2
--------+----------+----------+----------+----------
4 | 0.67 | 10.00 | 0.64 | 65.23
5 | 1.55 | 45.00 | 1.23 | 23.25
6 | 3.60 | 69.00 | 2.98 | 62.66
How will I manage unique column names for this output?

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Usage-of-function-retruning-record-in-query-tp4549140p4550092.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message lists-pgsql 2011-07-04 18:31:52 Re: Usage of function retruning record in query
Previous Message Harald Fuchs 2011-07-04 13:41:12 Re: Usage of function retruning record in query