SQLite – Compare Two Columns and Remove Duplicate Characters

sqlite

Example table:

  ID      CA      CB
  ------  ------  -----
  1       龍      龍 竜 龒
  2       齒      歯 齒 
  3       黽      黽

I would like to modify column CB so that it doesn't contain any of the characters in CA.
Like this:

  ID      CA      CB
  ------  ------  -----
  1       龍       竜 龒
  2       齒      歯 
  3       黽       

(SQLite)

Best Answer

Assuming that you mean to remove the character of CA from CB in the same row and that there's always just one character in CA, you can do it like this:

UPDATE your_table
SET CB = REPLACE(CB, CA, '');