Objektová akce

Kód:
6
Tělo:
Select '76', RightSide_ID from Relations where REL_DEF = 1002 AND LeftSide_ID = :OBJID 
  union Select '73', RightSide_ID from Relations where REL_DEF = 1005 AND LeftSide_ID = :OBJID
    union Select '20', RightSide_ID from Relations where REL_DEF = 1013 AND LeftSide_ID = :OBJID
      union Select 'CO', RightSide_ID from Relations where REL_DEF = 1017 AND LeftSide_ID = :OBJID
        union Select '30', RightSide_ID from Relations where Rel_def = 1034 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='02' 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='02' AND PO3.PDocument_ID=:OBJID)                  

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