I need a query to fill the column netto
from table test
with values from lv
from table co
when two conditions (test.sp= co.sp) AND (test.ver= co.ver)
are given
Table test:
sp | ver | netto |
---|---|---|
A | X | Null |
B | Y | Null |
C | Z | Null |
Table co:
sp | ver | lv |
---|---|---|
A | X | F |
B | Y | G |
C | Z | H |
I've tried this query, but it doesn't work.
UPDATE test
SET test.netto= co.lv
FROM test
JOIN co ON (test.sp= co.sp) AND (test.ver= co.ver);
Result should be (table test):
sp | ver | netto |
---|---|---|
A | X | F |
B | Y | G |
C | Z | H |
I get the following error message:
Error : ERROR: table name specified more than once