Re: Simple Delete Gets Complex (What if delete becomes modify???)
Posted in 1997
On Fri, 18 Jul 1997 14:17:15 GMT, while dropping acid jtsui@netcom.com
(MRSW) spewed:
:While reading this thread, this question pops to my mind! What if we want
:to update some field in Table_A based on some fields in Table_A and Table_B?
:Of course we can write a script or a ESQL/C program, but can we do it in
:a SQL stmt??? All the creative souls all there please help! :-)
In some cases you can perform an update or delete by querrying a value
from a table like this:
select unique columnA, columnB from table_1 into temp temp1
with no log;
update table table_2 set columnA = (select columnB from temp1
where columnA = "UNIQUE VALUE")
:<snip>
:>> Deleting rows from table "Table_A" based on results of a subquery which
:>> requires an additional table "Table_B".
: