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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -