Dodjeljivanje statusa u vd

insert into tPA_SetDocTypeStat (acDocType, acStatus, acVerified, acName)
select g.acDocType, 'N', 'F', 'Nepotvrđen'
from tPA_SetDocType g
left join tPA_SetDocTypeStat t on g.acDocType = t.acDocType and t.acStatus = 'N'
where t.acDocType is null
    union all
select g.acDocType, 'P', 'T', 'Potvrđen'
from tPA_SetDocType g
left join tPA_SetDocTypeStat t on g.acDocType = t.acDocType and t.acStatus = 'P'
where t.acDocType is null