Search Postgresql Archives

UPDATE of several columns using SELECT statement

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

 



Hello,

 

I am facing the following problem, nothing tough, I guess (hope)….think it should be some syntactical problem:

 

1. When trying to update two columns

UPDATE myFirstTable SET (fistCol, secCol) = (  SELECT anotherFistCol, anotherSecondCol FROM mySecondTable )

 

I am getting: ERROR:  syntax error at or near "select"

 

 

2. When changed to (only the parentheses are changed):

UPDATE myFirstTable SET (fistCol, secCol) = ((  SELECT anotherFistCol, anotherSecondCol FROM mySecondTable ))

 

I am getting: ERROR:  number of columns does not match number of values

 

Does anybody know, what I am doing wrong? Thank you very much and wish you a luxurious day

 

Adam


[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