gpt4 book ai didi

html - SQL语句用多个where条件更新多列

转载 作者:行者123 更新时间:2023-11-29 13:19:14 26 4
gpt4 key购买 nike

所以我有如下SQL语句:

db.exec("UPDATE products SET product_description = '#{fj_description}' AND personalization = '#{fj_personalization}' AND product_photo = '#{fj_product_photo}' AND order_information = '#{fj_order_information}' WHERE campaign_name = '#{camp_name}' AND product_type = 'fleecejacket'")

所有变量都返回从 HTML 输入字段中检索到的正确文本,因此 sql 语句似乎有问题。当我尝试更新数据库时,出现此错误:

PG::InvalidTextRepresentation at /update_products
ERROR: invalid input syntax for type boolean: "soft, midweight fleece" LINE 1: UPDATE products SET product_description = 'soft, midweight f... ^

最佳答案

尝试使用逗号代替AND:

"UPDATE products 
SET product_description = '#{fj_description}',
personalization = '#{fj_personalization}',
product_photo = '#{fj_product_photo}',
order_information = '#{fj_order_information}'
WHERE campaign_name = '#{camp_name}'
AND product_type = 'fleecejacket'"

关于html - SQL语句用多个where条件更新多列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44810513/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com