update column

Поиск
Список
Период
Сортировка
От ssylla
Тема update column
Дата
Msg-id 1328752685274-5468330.post@n5.nabble.com
обсуждение исходный текст
Список pgsql-sql
Dear list,

sorry, I already posted this, but it did not seem to have been accepted by
the mailing list. So here's my second try:

I need to update all rows of a column ('parent') based on a subquery that
returns me the first four digits of another column ('id'):

UPDATE admin SET parent=(SELECT SUBSTR(id,1,4) FROM admin);


After executing, I get the following error-message:

"more than one row returned by a subquery used as an expressionmore than one
row returned by a subquery used as an expression"


I am not quite sure about that, but maybe I need to construct a
function/loop to fulfill this task?

thanks for help.

Stefan 

--
View this message in context: http://postgresql.1045698.n5.nabble.com/update-column-tp5468330p5468330.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.


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

Предыдущее
От: Bear
Дата:
Сообщение: Re: problem with nested dblink function
Следующее
От: ssylla
Дата:
Сообщение: update column with multiple values