daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Jan 24th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.     co.clientId           AS clientId,
  3.     co.createTime         AS orderDate,
  4.     cop.clientOrderId     AS orderId,
  5.     cop.id                AS orderPositionId,
  6.     cop.count             AS quantityOrder,
  7.     coph.statusId         AS statusId,
  8.     osps.name             AS statusName,
  9.     sum(coph.changeCount) AS quantityStatus
  10. FROM
  11.     ClientOrder co
  12.     JOIN ClientOrderPosition cop
  13.          ON co.id = cop.clientOrderId
  14.     JOIN ClientOrderPositionHistory coph
  15.          ON cop.id = coph.clientOrderPositionId AND
  16.             coph.statusId IN (3, 4)
  17.     JOIN OrderSubPositionStatus osps
  18.          ON coph.statusId = osps.id
  19. WHERE
  20.     co.createTime > '2019-01-01 00:00:00'
  21.   AND co.createTime < '2019-01-23 00:00:00'
  22. GROUP BY
  23.     cop.id        ASC,
  24.     coph.statusId ASC
  25. HAVING
  26.     quantitystatus > 0
  27. ORDER BY
  28.     orderDate ASC;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top