-
update table
I've 2 tables
table cod with more 4000 records:
code
axyz-0-12345678
axfr-0-23456789
asdf-0-22323232
aa3r-0-11111122
..............
..............
and table code_id with 250 records that are also in table cod
id
axyz-0-12345678
axfr-0-23456789
...............
Can I update table cod with these new codes??
code
axyz-Z-12345678
axfr-Z-23456789
if cod.code=code_id.id then xxxx-Z-xxxxxxxx
Coul you help me??
Thanks
Raf
-
Did you try this?:
update code u
set code_id = (
select replace(code_id,'-0-','-Z-')
from cod
where cod.code_id = u.code_id)
where exists (
select '?'
from cod
where cod.code_id = u.code_id);
:D