select DISTINCT '21', billofdelivery_id
FROM
posdocuments
WHERE
billofdelivery_id is NOT NULL
AND ID = :OBJID
union
select DISTINCT 'RO', receivedorder_id
FROM
posdocuments
WHERE
receivedorder_id is NOT NULL
AND ID = :OBJID
union
select DISTINCT '23', refundedbillofdelivery_id
FROM
posdocuments
WHERE
refundedbillofdelivery_id is NOT NULL
AND ID = :OBJID
union
select DISTINCT '20', receiptcard_id
FROM
posdocuments
WHERE
receiptcard_id is NOT NULL
AND ID = :OBJID
union
select DISTINCT '26', InventoryShortFall_ID
FROM
posdocuments
WHERE
InventoryShortFall_ID is NOT NULL
AND ID = :OBJID
union
select DISTINCT '25', InvOverPlus_ID
FROM
posdocuments
WHERE
InvOverPlus_ID is NOT NULL
AND ID = :OBJID
union
select DISTINCT 'PS', possummareddocument_id
FROM
posdocuments
WHERE
possummareddocument_id is NOT NULL
AND ID = :OBJID
union
select DISTINCT 'PR', posreceipt_id
FROM
posdocuments
WHERE
posreceipt_id is NOT NULL
AND ID = :OBJID
union
SELECT
DISTINCT 'PM', A.LeftSide_ID
FROM
Relations A
WHERE
(A.RightSide_ID = :OBJID) AND (Rel_Def = 1681)
union
select DISTINCT 'PH', POSShift_ID
FROM
posdocuments
WHERE
POSShift_ID is NOT NULL
AND ID = :OBJID Generated by ABRA Software a.s. 27.10.2021 16:34:30