Roderick Schertler wrote:
In 4gl:
prepare del_id from
"delete from first_tbl where col_a=? and col_b=?"
prepare sel_id from
"select col_a, col_b ",
"from second_tbl "
declare sel_cur cursor for sel_id
foreach sel_cur into p_col_a, p_col_b
execute del_id using p_col_a, p_col_b
end foreach
If you don't have 4gl or ESQL/C (which would work similarly), sorry.
Douglas Wilson
>
> What's the right way to delete rows from a table which match a
> multi-part key? I've got a table with a two part key and a unique
> composite index on the key columns. I can't figure out an efficient way
> to delete all the rows whose keys appear in a second table. That is, if
> the main table contains these rows
>
> column a column b
> -------- --------
> 1 a
> 1 b
> 2 a
> 2 b
>
> and the second table contains
>
> 1 a
> 2 b
>
> I want to be left with
>
> 1 b
> 2 a