Objektová akce

Kód:
6
Tělo:
Select '76', RightSide_ID from Relations where REL_DEF = 1009 AND LeftSide_ID = :OBJID 
  union Select '73', RightSide_ID from Relations where REL_DEF = 1010 AND LeftSide_ID = :OBJID
    union Select '20', RightSide_ID from Relations where REL_DEF = 1014 AND LeftSide_ID = :OBJID
      union Select 'CO', RightSide_ID from Relations where REL_DEF = 1018 AND LeftSide_ID = :OBJID
      
UNION ALL
/* Plat. prikaz */

SELECT distinct '18', PO.ID
FROM PaymentOrders PO
WHERE PO.ID IN (SELECT PO2.Parent_ID 
  FROM PaymentOrders2 PO2
  WHERE PO2.ID IN (SELECT PO3.Parent_ID 
    FROM PaymentOrders3 PO3
    WHERE PO3.PDocumentType='12' AND PO3.PDocument_ID=:OBJID))

union all
/* Žádosti plat. prikazů */    
SELECT distinct 'PO', PO2.ID
  FROM PaymentOrders2 PO2
  WHERE
    PO2.parent_id is null AND
    PO2.ID IN (SELECT PO3.Parent_ID
    FROM PaymentOrders3 PO3
    WHERE PO3.PDocumentType='12' AND PO3.PDocument_ID=:OBJID)      
 

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