[MonetDB-users] Update statement to update from other table
Hi all... I'm testing MonetDB and evaluating all functionality. One item I've not been able to find much info on is updating table A from table B. ie... UPDATE PERSON SET SALARY = sal.newval FROM PERSON P, SAL_DATA sal WHERE p.id = sal.p_id Or something to that effect :) Is it possible? Thanks Cronje
On Tue, Aug 05, 2008 at 05:20:34PM +0200, Cronje Fourie wrote:
Hi all... I'm testing MonetDB and evaluating all functionality. One item I've not been able to find much info on is updating table A from table B. ie... UPDATE PERSON SET SALARY = sal.newval FROM PERSON P, SAL_DATA sal WHERE p.id = sal.p_id Or something to that effect :) Is it possible?
Yes The following should work UPDATE person SET salary = (SELECT sal.newval FROM SAL_DATA sal WHERE person.id = sal.p_id) WHERE id in (SELECT sal.p_id FROM SAL_DATA sal) ; Niels
Thanks Cronje
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Niels Nes, Centre for Mathematics and Computer Science (CWI) Kruislaan 413, 1098 SJ Amsterdam, The Netherlands room C0.02, phone ++31 20 592-4098, fax ++31 20 592-4312 url: http://www.cwi.nl/~niels e-mail: Niels.Nes@cwi.nl
participants (2)
-
Cronje Fourie
-
Niels Nes