Kirk Abbott wrote:
Hello,
I am having trouble with the syntax for doing an update using 2 tables. In postgres, one can do something like:
update table1 set name = table2.name from table2 where table1.id = table2.id ;
In oracle (it's something like)
update table1 a set name = (select b.name from table2 b where a.id = b.id) ;
What is the correct way to do this in MonetDb (as both of the above fail) You can see the syntax here: http://monetdb.cwi.nl/projects/monetdb/SQL/Documentation/Data-Manipulation.h...
You did a little mistake on your update statement, in the from clause of your select you forgot table1 ;) update table1 set name = (select b.name from table2 b, table1 a where a.id = b.id) ; That should work ;) Regards, Romulo
Thanks, Kirk.
------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users