mysql - Update a column with the combined results of multiple other columns in the same table -


i'm trying combine results of select single column within same table (moving individual columns storing multiple fields in json object). select query works fine, when try combine update get:

you can't specify target table 'app_config' update in clause

i'm not sure i'm doing wrong (and i'm not great @ sql), appreciated.

combined sql:

update app_config set sms_config = (      select concat( '{"user_name":"', app_id, '","user_id":', sms_user_id, ',"user_auth":"', sms_user_auth, '"}' )      app_config     sms_user_id not null , sms_user_id > 0  ) 

i think want.

update app_config set sms_config = concat( '{"user_name":"', app_id, '","user_id":'                       , sms_user_id,  ',"user_auth":"', sms_user_auth, '"}') sms_user_id > 0  

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -