简体   繁体   English

如何使用准备好的语句更新 MySQL 文本列?

[英]How to update MySQL text column with concat with a prepared statement?

I am trying to concatenate a text column with UPDATE in my database but I am unable to find any resouces online that explain how to do with a prepared statement.我正在尝试在我的数据库中将文本列与UPDATE连接起来,但我无法在网上找到任何解释如何处理准备好的语句的资源。 I keep getting an error:我不断收到错误消息:

syntax to use near '(admin_notes=?) WHERE id=?'在 '(admin_notes=?) WHERE id=?' 附近使用的语法at line 1在第 1 行

UPDATE problem_report SET concat(admin_notes=?) WHERE id=?

You are trying to UPDATE the admin_notes column.您正在尝试更新 admin_notes 列。 You need to concat the value not the column itself.您需要连接值而不是列本身。

UPDATE problem_report SET admin_notes = concat(admin_notes,?) WHERE id=?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在准备好的 MySQL 语句中使用组 concat? - How to use group concat in a prepared MySQL statement? 如何以准备好的语句更新mysql 5.7中json列中的键的动态数目 - How to update dynamic number of keys in json column in mysql 5.7 as prepared statement mysql编写语句:更新查询 - mysql prepared statement : Update query 如何将多个GET参数合并为准备好的语句 - How to concat multiple GET arguments into a prepared statement 如何在准备好的语句中使用sql函数CONCAT - How to use the sql function CONCAT with a prepared statement 如何在mysql中使用多个if语句的输出更新列文本值? - How to update column text value with the output of multiple if statement in mysql? 如何使用准备好的语句从 MySQL 数据库中获取日期列并格式化 - How to get the date column from MySQL database with prepared statement and format it 将准备好的语句与 CONCAT 一起使用时出现 MySQL 语法错误 - MySQL syntax error when using prepared statement with CONCAT 使用regexp + concat编写的语句中的MySQL查询语法问题 - MySql query syntax issue within prepared statement with regexp + concat 如何在 MySQL 准备好的语句中包含“”? - How to include ' ' in MySQL Prepared Statement?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM