Re: UPDATE tuples with a sub-select
От
Gerhard Heift
Тема
Re: UPDATE tuples with a sub-select
Дата
Msg-id
20081107123510.GC6158@toaster.kawo1.rwth-aachen.de
Ответ на
UPDATE tuples with a sub-select (Thomas Kellerer)
Список
Дерево обсуждения
UPDATE tuples with a sub-select Thomas Kellerer <spam_eater@gmx.net>
Re: UPDATE tuples with a sub-select Gerhard Heift <gheift@kawo1.rwth-aachen.de>
Re: UPDATE tuples with a sub-select Gerhard Heift <ml-postgresql-20081012-3518@gheift.de>
Re: UPDATE tuples with a sub-select Thomas Kellerer <spam_eater@gmx.net>
Re: UPDATE tuples with a sub-select Gerhard Heift <ml-postgresql-20081012-3518@gheift.de>
Re: UPDATE tuples with a sub-select Thomas Kellerer <spam_eater@gmx.net>
Re: UPDATE tuples with a sub-select Tom Lane <tgl@sss.pgh.pa.us>
Re: UPDATE tuples with a sub-select Thomas Kellerer <spam_eater@gmx.net>
On Fri, Nov 07, 2008 at 11:15:07AM +0100, Thomas Kellerer wrote:
> Hi,
>
> are there any plans to support updating a tuple using a sub-select in one of the future versions.
>
> e.g, something like:
>
> UPDATE report_table
> SET (order_count,order_value) = (SELECT count(*), sum(amount)
> FROM order o
> WHERE o.customer_id = report_table.customer_id);
What about:
UPDATE report_table SET order_count = s_count, order_value = s_value
FROM (SELECT count(*) AS s_count, sum(amount) AS s_value FROM order o
WHERE o.customer_id = report_table.customer_id)
Its untested, but I think, it must works like this.
> I know it's currently not possible (so we need to revert to two sub-selects) but I was wondering if this somewhere on the "roadmap"
>
> Regards
> Thomas
Regards,
Gerhard
В списке pgsql-general по дате отправления
От: Michelle Konzack
Дата: