Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $nonauth = 1;
- require_once 'config.inc.php';
- $db = Db::getInstance();
- $res = $db->q("SELECT SUBSTRING_INDEX(annul,',', annulc) AS annul, products_quantity, c AS alltasks, pp FROM (
- SELECT
- GROUP_CONCAT(IF(sh.`id` IS NULL , p.`id`, NULL) ) AS annul,
- (COUNT(p.id) - op.`products_quantity`) AS annulc, COUNT(p.id) AS c, op.`products_quantity`, GROUP_CONCAT(p.status), op.`orders_products_id`,
- GROUP_CONCAT(p.id) AS pp
- FROM orders_products op, wms_task_pickup p
- LEFT JOIN wms_task_pickup_shipment sh ON (sh.`is_sorted` = 1 AND sh.`pickup_task_id` = p.id)
- WHERE p.`orders_products_id` = op.`orders_products_id` AND p.`status` <= 3
- GROUP BY op.orders_products_id
- HAVING c > op.products_quantity) AS c");
- var_dump($res);
- exit;
Advertisement
Add Comment
Please, Sign In to add comment