Escolar Documentos
Profissional Documentos
Cultura Documentos
where exists
(
select
pe.interno_produto
from produto_estabelecimento pe
left join sp_custo_produto(pe.interno, '31.12.2019') sp on 0=0
where pe.interno_produto = produto.interno and ((sp.custo_medio = 0) or
(sp.custo_medio is null))
)