Třídová akce

Kód:
20
Tělo:
SELECT
  S2.Parent_ID
FROM StoreDocuments2 S2
JOIN StoreDocuments S ON S.ID = S2.Parent_ID
JOIN ReceivedOrders2 R2 ON R2.ID = S2.ProvideRow_ID 
LEFT JOIN StoreDocuments2 RB2 ON S2.ID = RB2.RDocumentRow_ID
WHERE
  (R2.Parent_ID = :ID) AND
  (S.DocumentType = '20') AND
  (S2.ProvideRowType = 'RO') AND
  ((S2.DeliveredQuantity + COALESCE(RB2.Quantity, 0)) < S2.Quantity)
GROUP BY S2.Parent_ID

Generated by ABRA Software a.s. 27.10.2021 16:34:11