Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- update fahasa_suborder
- set status = 'unassigned'
- where suborder_id in (
- select so.suborder_id
- from (
- select b.*
- from (
- select a.order_id, a.suborder_id, a.status, a.bookstore_id
- from (
- select so.order_id, so.suborder_id, so.status, so.bookstore_id
- from fahasa_suborder so
- join fhs_sales_flat_order o on so.order_id = o.increment_id
- where so.bookstore_id = 4
- and o.don_si is null
- and o.protect_code in ('flashsale_manual','tiki19_manual')
- ) a
- join fahasa_suborder so on so.order_id = a.order_id
- group by a.order_id having count(so.order_id) = 1
- ) b
- left join fahasa_bookstore_log l on l.order_id = b.order_id and l.action in ('cancelOrder','cancelOrderViaFahasaApp','cancelOrderViaWebsite')
- where l.id is null
- ) c
- join fahasa_suborder so on so.suborder_id = c.suborder_id and c.order_id = so.order_id
- where so.status != 'canceled'
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement