UPDATE

                xxx_zy_supplier_item_id id

                SET `status` = 1

                WHERE

                orderID IN (

                SELECT

                line.salesOrderID

                FROM

                xxx_zy_carrier_note note

                LEFT JOIN

                xxx_zy_carrier_note_line line ON note.mainID =

                line.carrierNoteID

                WHERE

                note.mainID = 'PU20160102124222960'

                ) 

这个sql更新了20多秒



mysql子查询的问题
 优化后


mysql子查询的问题
 

 sql语句修改成:

UPDATE

kplus_zy_supplier_item_id id,

(SELECT

line.salesOrderID as orderID

FROM

kplus_zy_carrier_note note

LEFT JOIN

kplus_zy_carrier_note_line line ON note.mainID =

line.carrierNoteID

WHERE

note.mainID = 'PU20160102124222960'

) x 

SET id.status = 1

WHERE

 

id.orderID=x.orderID

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
  • 2021-10-05
  • 2022-12-23
猜你喜欢
  • 2022-01-11
  • 2022-12-23
  • 2021-07-19
  • 2022-12-23
  • 2021-05-10
  • 2021-11-13
相关资源
相似解决方案