Boa tarde,
Necessito de ajuda, pois não consigo encontrar razão para o erro.
Obrigada
select *
from
(select distinct BIFREF as 'cotação',bo.nmdos as 'Doc', bo.obrano as 'nr', bo.dataobra as 'Data',sum(bi.ETTDEB) as 'Total enc'
from bo (nolock),bi (nolock)
where
bi.nmdos ='ENC. A FORNECEDOR'
and
bi.bostamp=bo.bostamp
and
ref <> ' '
and
bifref='005/2014'
group by BIFREF,bo.nmdos, bo.obrano, bo.dataobra) enc
left outer join
(select enc.cotação,enc.Doc, enc.nr, enc.Data,sum(guial.ETTDEB) as 'Total Guia'
from enc (nolock),bi as guial (nolock)
where
enc.nmdos ='GUIA DE ENTREGA FORN'
and
guial.bostamp = enc.bostamp
and
guial.ref <> ' '
and
guial.bifref='005/2014') guia
on
guia.TPSTAMP = enc.TPSTAMP
group by enc.obrano,enc.nmdos,enc.dataobra
order by enc.obrano,enc.nmdos,enc.dataobra
Invalid object name 'enc'.