select distinct vs.id_sys, cc.id_vst,
case
when vs.id_sys=28 and cc.id_vst='1' then cast('Р' as varchar(80))
else ''
end as visible
from doc_acc_cnt cc
left join doc_acc_cnt_cons vs on cc.id_doc= vs.id_doc
where cc.id_doc= vs.id_doc
Что-то в скобках не верно прописано:
select distinct vs.id _sys, cc.id _vst,
case
when vs.id _sys=#28 and cc.id _vst='1' then Cast ('(Р) ' as integer) as varchar(80))
else cast('' as varchar(80))
end visible,
from doc_acc_cnt cc
left join doc_acc_cnt_cons vs on cc.id _doc= vs.id _doc
where cc.id _doc= vs.id _doc