-1
I need to increment in the command below, where it is possible to return a result bringing only a.2PRECO_CUST
different (<>) from a1.PRECOUNIT
when the difference is above 30% between these two columns.
From now on I thank you all.
select a3.NUMNOTA,a2.CODPROD,a2.DESCRICAO,a2.BARRA,a2.PRECO_CUST as Custo_Cadastro,
a1.PRECOUNIT as Custo_Nota from ITMENTRADANF as a1
inner join PRODUTOS as a2 on a1.CODPROD = a2.CODPROD
inner join ENTRADANF as a3 on a3.CODENTRADANF=a1.CODENTRADANF
where a1.PRECOUNIT <> a2.PRECO_CUST
Replaces your
WHERE
for:WHERE a1.PRECOUNIT NOT BETWEEN 0.7 * a2.PRECO_CUST AND 1.3 * a2.PRECO_CUST
– Sorack
you can use a case when.
– Marcos Brinner
@Sorack, sorry perhaps my ignorance, but this Where, the values you defined '0.7' and '1.3', could answer me which is alogical that will be done when executing, I did, I executed but did not understand the return of the result within this Where you sent me. Thanks in advance.
– Josias Amorim
0.7 = 70%
and1.3 = 130%
, two values which have a greater difference than30%
– Sorack
So I get it. Thanks for helping my friend.
– Josias Amorim