Search Postgresql Archives

Re: Selecting from a function(x,y) returning a row-type(sum, prod)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tom Lane wrote:
> "A. Kretschmer" <andreas.kretschmer@xxxxxxxxxxxxxx> writes:
>> am  Mon, dem 30.04.2007, um 15:45:18 +0200 mailte Heiko Klein folgendes:
>>> How can I do the following:
>>>
>>> select * from myvals, sum_n_product(myvals.x, myvals.y);
> 
>> select x, y, sum_n_product(x,y) from myvals;

> regression=# select x,y,(f).* from
> regression-#   (select *, sum_n_product(x,y) as f from myvals offset 0) ss;

If you really just want to calculate product and sum, it may be easier
to write just:

select x, y, x + y as sum, x * y as prod from myvals;

No need for fancy SP's in that case.
-- 
Alban Hertroys


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux