0
UPDATE A,B
SET A.a = 'something'
WHERE A.b = B.b AND A.c = B.C;

I have this code inside a function in sql, but it doesn't work. I fill table B inside the function but first of all when I want to use it in the update above I get an Error like FROM Clause-B or something. And secondly a get an error for the comma next to A. What can I do instead of the code above? Does anybody knows where the problem is?

crthompson
  • 15,653
  • 6
  • 58
  • 80
  • 1
    You can not use multiple table names after UPDATE keyword. You can only update 1 table. If you are trying to join, you can not join like that. Please provide the A,B table structure and give more details. – Orcun Yucel May 13 '15 at 23:17
  • 1
    In addition to @Orchun's excellent suggestion, please post the full actual error instead of a haphazard guess. – crthompson May 13 '15 at 23:18
  • You are essentially asking: [How to do an update + join in PostgreSQL?](http://stackoverflow.com/questions/7869592/how-to-do-an-update-join-in-postgresql) I'm voting to close your question as a duplicate of that one. – Andriy M May 13 '15 at 23:28

0 Answers0