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

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Selecting from a function(x,y) returning a row-type(sum, prod)
Дата
Msg-id 4636FC19.70005@magproductions.nl
обсуждение исходный текст
Ответ на Re: Selecting from a function(x,y) returning a row-type(sum, prod)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom Lane wrote:
> "A. Kretschmer" <andreas.kretschmer@schollglas.com> 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: pgsql and Mac OS X
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: [HACKERS] SOS, help me please, one problem towards the postgresql developement on windows