Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT tmp.*, MAX(tmp.width+tmp.height+tmp.depth) AS dsum, MAX(tmp.weight) / (MAX(tmp.width)*MAX(tmp.height)*MAX(tmp.depth)) AS density
- FROM
- (SELECT eob.width, eob.height, eob.depth, eob.weight, COUNT(eob.id) pio, oi.product_id
- FROM external_order_box eob
- LEFT JOIN external_order eo ON eo.id = eob.external_order_id
- LEFT JOIN `order` o ON o.id = eo.erp_order_id
- LEFT JOIN order_item oi ON oi.order_id = o.id
- GROUP BY eo.id) AS tmp
- LEFT JOIN product p ON p.id = tmp.product_id
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement