update v9_hits SET hitsid = REPLACE(hitsid,'c-12-','c-13-')
where 1 = ( case when(select COUNT(*) from v9_photo where id=replace(hitsid,'c-12-',''))>0 then '1' else '0' end)
from v9_hits,v9_photo where id=replece(hitsid,'c-12-','')
這表示用尾號連接,能連接上的就給你修改.