SELECT
A.ID
FROM
AccPresetDefs A
LEFT JOIN DocQueues DQ on DQ.ID = A.ComputedDocQueue
and DQ.DocumentType = :DocumentType2
and DQ.CODE = :DocQueueCode
WHERE
(A.DocumentType=:DocumentType)
and (A.Code=:Code)
and ComputedDocQueue = coalesce(DQ.ID, '0000000000')Generated by ABRA Software a.s. 27.10.2021 16:34:07