pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: gmb <gmbouwer@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Usage of function retruning record in query
Date: Mon, 4 Jul 2011 06:59:49 -0700 (PDT)
Message-ID: <1309787989162-4550092.post@n5.nabble.com> (raw)
In-Reply-To: <868vseduyv.fsf@mgm.protecting.net>
References: <1309762075448-4549140.post@n5.nabble.com>
	<868vseduyv.fsf@mgm.protecting.net>


Harald Fuchs-10 wrote:
> In article <1309762075448-4549140.post@n5.nabble.com>,gmb
> &lt;gmbouwer@gmail.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-tp4549140p455009...
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.



view thread (8+ messages)  latest in thread

Message-ID: <1309787989162-4550092.post@n5.nabble.com>
Permalink:  ../1309787989162-4550092.post@n5.nabble.com/
Also on:    postgresql.org/message-id/1309787989162-4550092.post@n5.nabble.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gmbouwer@gmail.com
  Subject: Re: Usage of function retruning record in query
  In-Reply-To: <1309787989162-4550092.post@n5.nabble.com>

* 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