简体   繁体   中英

MySQL #1241 - Operand should contain 1 column(s)

I want to update the column 'page_inv', so it will replace two last chars of this column, and add new data, for example:

'{"userItems":[{item1}]}' -> '{"userItems":[{item1}' -> '{"userItems":[{item1}, {item2}]}'

UPDATE `users` 
SET `page_inv`=CONCAT((SELECT `page_inv`, SUBSTRING( `page_inv`, 1, CHAR_LENGTH( `page_inv` )) -2), ',{newItem}]}') 
WHERE `STEAMID`=76561198147

My DB:

在此输入图像描述

Something like this?

UPDATE `users`
    SET page_inv= CONCAT(left(page_inv, length(page_inv) - 2), ',{newItem}]}') 
    WHERE STEAMID = 76561198147;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM