notruiyi 2021-08-27 11:34 采纳率: 0%
浏览 57

oracle update语法问题

需要update 数据成 满足条件的第一行

运行提示信息

 update mg.detail a set (id, promotion_price)= 
(
 select sub.id, sub.promotion_price from  
    (select b.id, b.shop_id, c.barcode, c.sale_scale, c.promotion_price,
     from mg.promotion b, mg.promotion_goods c 
     where c.id = b.id and b.status = 0 and b.start_time <= sysdate and b.finish_time >= sysdate 
     and b.shop_id = a.shop_id and c.barcode = a.barcode and c.sale_scale = a.sale_scale 
     order by b.id
    ) sub 
  where rownum=1
) 
where exists (select 1 from mg.promotion b, mg.promotion_goods c 
where c.id = b.id and b.status = 0 and b.start_time <= sysdate and b.finish_time >= sysdate 
and b.shop_id = a.shop_id and c.barcode = a.barcode and c.sale_scale = a.sale_scale)

img

确定表格字段没问题,感觉是ORACLE update 不支持该语法;删除sale_scale条件后 提示barcode字段,删除barcode条件后 提示shop_id字段

  • 写回答

2条回答 默认 最新

  • CSDN专家-link 2021-08-27 11:36
    关注

    mg.detail表中有没有SALE_SCALE字段呢

    评论

报告相同问题?

问题事件

  • 修改了问题 8月27日
  • 修改了问题 8月27日
  • 创建了问题 8月27日

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题