0
I am trying to join data from three tables using this sql:
SELECT cod_nota, cupom, valor_contrato, valor_cadastro, data_emissao
FROM cupons_nota, vendas, notas_fiscais
WHERE cupons_nota.cupom = vendas.numero_nf AND notas_fiscais.cod_cliente='00000212' AND data_emissao BETWEEN '01.03.2018' AND '30.04.2018'
ORDER BY cod_nota ASC;
The problem is that it’s returning the triplicate data, and I wanted only once the dice.
Example of the result:
What is the expected result?
– Roberto de Campos
it returns "triplicate" because you must have 3 notes for this client. I repeat the question of @Robertodecampos, "what is the expected result"?
– rLinhares
The expected result was a single line, not the three.
– Marcos Correia
if you have to add a column (add, average, max, min) use the
group by
. If the data is correct and are only duplicating because of Join, use theDistinct
– Rovann Linhalis
how would you look wearing the Distinct?
– Marcos Correia
Select distinct ......(everything is already the same.).....
– Rovann Linhalis