Re: Update from select
От | Justin Tocci |
---|---|
Тема | Re: Update from select |
Дата | |
Msg-id | E0C39D8E-D0D8-498F-8041-37EFEE962E42@workflowproducts.com обсуждение исходный текст |
Ответ на | Update from select (Bret Stern <bret_stern@machinemanagement.com>) |
Ответы |
Re: Update from select
|
Список | pgsql-general |
em stands for "easy money" update tbl1 set col3=em.col3,col4=em.col4,col5=em.col5 from (select col3, col4,col5 from tbl2 where col1="criteria") em Regards, Justin Tocci Programmer www.workflowproducts.com 7813 Harwood Road North Richland Hills, TX 76180 phone 817-503-9545 skype justintocci On May 13, 2013, at 3:23 PM, Bret Stern <bret_stern@machinemanagement.com> wrote: > PG 8.4 > > Having trouble putting together an update query to update > multiple columns in tbl1 from columns in tbl2. > > update tbl1 > set col3,col4,col5 > from > (select col3, col4,col5 from tbl2 where col1="criteria") > > > > Can someone add to the Postgres Docs (shown below) to help me with this. > > UPDATE employees SET sales_count = sales_count + 1 WHERE id = > (SELECT sales_person FROM accounts WHERE name = 'Acme Corporation'); > > > Many thanks > > Bret Stern > > > > -- > Sent via pgsql-general mailing list (pgsql-general@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general
В списке pgsql-general по дате отправления: