1
I need to select data from a table only when the codigo
this table does not appear in a second table. Briefly this would be it. I have the table entregaitem
with the following columns (codigo,codigoentrega,codigoestoque)
and the table retorno
where one of the columns is (codigoentregaitem)
. My need is to create a query
that selects all items from the table entregaitem
when codigo
does not exist in the table retorno
, I thought of something like:
select * from public.entregaitem where NOT EXITS
(select public.entregaitem.codigo, public.retorno.codigoentregaitem
from public.entregaitem,public.retorno
where public.entregaitem.codigo = public.retorno.codigoentregaitem)
But so nothing was returned to me. Due to existing data where the code are different
Possible duplicate of How to create Mysql search that returns lines without matching?
– Bacco