duangenshi9836 2012-05-02 14:10
浏览 159

UPDATE查询无法使用LIMIT

hi i am using an UPDATE query with limit 0,1 where i have to update the first row which matches the condition which i m giving in the query

mysql_query("UPDATE `product_option` SET `input_value`='$color_a',`input_price`='$color_price_a' WHERE `product_id`='$_REQUEST[pid]' and `input_type`='option' LIMIT 0,1"); 

in my sql table the $_request[pid] is repeating many times so on that rows in which $_request[pid] is matching, i want to update the first row on it but this query is not doing any thing the data is still same which i have added.

any suggestion will be appreciated

here is the image of the table

enter image description here

  • 写回答

1条回答 默认 最新

  • doumi7861 2012-05-02 14:11
    关注

    It should be LIMIT 1

    LIMIT 0,1 means OFFSET 0 LIMIT 1, but UPDATE does not support offsets.

    Even if it would work (which it doesn't) you still always have to supply an ORDER clause or it will be a random row.

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大