How to update the X column with Y column in the same table,where the X column contains some numbers like 123456

Viewed 29

How to update the X column with Y column in the same table(original table),where the X column contains some numbers like 123456 etc,,.I executed the following query but i couldnt make it out,can someone pls help me.(Hint: wherever we get 123456 values in X column that complete values should be replaced with the values in Y column)-SQL

here is the query what i had tried so far

 Update original table
    Set x=case when instr((x),'123456')<>0
    Then trim(replace (x,'x','y'))
    End,
    Where x in (select x from temp table where x_review=1)
1 Answers

try this please.

update id_val set x=y where instr(x,'12345')>0;
Related