rdfx

na sklade mudaki

May 24th, 2021 (edited)
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.62 KB | None | 0 0
  1. SELECT tmp.*, MAX(tmp.width+tmp.height+tmp.depth) AS dsum,   MAX(tmp.weight/1000) / ((MAX(tmp.width)/1000)*(MAX(tmp.height)/1000)*(MAX(tmp.depth)/1000)) AS density
  2. FROM
  3. (SELECT eob.width, eob.height, eob.depth, eob.weight, COUNT(eob.id) pio, oi.product_id
  4. FROM external_order_box eob
  5. LEFT JOIN external_order eo ON eo.id = eob.external_order_id
  6. LEFT JOIN `order` o ON o.id = eo.erp_order_id
  7. LEFT JOIN order_item oi ON oi.order_id = o.id
  8. GROUP BY eo.id) AS tmp
  9. LEFT JOIN product p ON p.id = tmp.product_id
  10. WHERE pio = 1 AND (p.width IS NULL OR p.weight IS NULL OR p.depth IS NULL OR p.height IS null) GROUP BY product_id
Add Comment
Please, Sign In to add comment