1
I have the following Query
:
SELECT
public.suprimento.suprimento,
public.estoque.numeroserie,
public.fornecedor.nome as fornecedor,
public.estoque.data as dataentrada,
public.estoque.numeronotafiscal,
public.empresa.nome as empresa,
public.entrega.data as datasaida,
public.entrega.notafiscalhss,
public.entrega.usuario,
public.entrega.usuariohss,
public.lotesretornosuprimento.dataretorno,
public.lotesretornosuprimento.laudo,
public.lotesgarantiastatus.numeroserieretornado
FROM
public.estoque,
public.suprimento,
public.fornecedor,
public.entregaitem,
public.entrega,
public.empresa,
public.lotesretornosuprimento,
public.lotesgarantiastatus
where
public.suprimento.codigo = public.estoque.codigosuprimento and
public.estoque.codigofornecedor = public.fornecedor.codigo and
public.entregaitem.codigoestoque = public.estoque.codigo and
public.entregaitem.codigoentrega = public.entrega.codigo and
public.empresa.codigo = public.entrega.codigoempresa and
public.lotesretornosuprimento.numeroserie = public.estoque.numeroserie and
public.lotesgarantiastatus.numeroserieenviado = public.estoque.numeroserie
Which returns me the entire route of the supply from the moment it is purchased to the return to our supplier for correct disposal or for warranty, my need however is also to display the supplies that way purchased but that have not yet been sent to some customer or returned to the supplier, in the way that I have assembled the Query
I select only the supplies that had the complete trail:
Buy -> Sell -> Return Supplier
It is possible to adapt this Query
to return to me also the following situations:
Buy -> Sell
And also when the supply is only purchased:
Buying
Possibly answered in What is the difference between INNER JOIN and OUTER JOIN?
– Bacco