Re: PROBLEM with simple SQL-statement
From: Michael Sallwasser <msallwas_at_world.nad.northrop.com>
Date: Mon, 20 Jun 1994 18:52:35 GMT
Message-ID: <CrpLrp.E07_at_gremlin.nrtc.northrop.com>
Date: Mon, 20 Jun 1994 18:52:35 GMT
Message-ID: <CrpLrp.E07_at_gremlin.nrtc.northrop.com>
In article <kooy.3.771678526_at_frw.ruu.nl> kooy_at_frw.ruu.nl (J.W. van der Kooy) writes:
>My plan was to update a column 'amount' with the value of 'price'
>multiplied by an appropriate VAT-rate from another table. I tried this:
>
>SQL> update MYTABLE set AMOUNT = PRICE *
> (select distinct VAT from VATTABLE where CATEG = 2);
>
>It did not work
Try this instead:
column VAT new_value VAT2
select distinct VAT from VATTABLE where CATEG = 2; update MYTABLE set AMOUNT = PRICE * &VAT2;
Note: This presumes you are using SQL*Plus (which you had stated you were) and that VAT is independent of the record being updated (which you example implied.)
I would appreciate knowing if this helps. Good luck!
-- ============================================================================ Michael Sallwasser | Down one path is utter dispair and hopelessness. Down Northrop Grumman | the other is total destruction. Let us choose wisely. ============================================================================Received on Mon Jun 20 1994 - 20:52:35 CEST