question

miladmjafari avatar image
miladmjafari asked

Update all valuse in a table with conditional situation

I want update all lex_desc with specific lang_code with all lex_desc with specific lang_code

how can i do this with sql in mySql ?

mysql
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
torgerud avatar image
torgerud answered

Maybe I misunderstand you question, but...
UPDATE yourtable SET lex_desc = 'some test' WHERE lang_code = 'EN'

Or...
To make it more versatile, but still fairly simple, try:
UPDATE yourtable SET lex_desc = CASE

WHEN lang_code = 'EN' THEN 'English'

WHEN 'KR' THEN 'Korean'

ELSE lang_code

END



10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.