[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
participants (2)
-
Cronje Fourie
-
Niels Nes