0
I have a problem with a query in an Oracle database in a table with 3 columns:
ID_Loja | Canal | Valor_Venda
There is the possibility of having more than one sale per store and I want to know which channel assigned to the store based on the amount of sales that each store had as an example below. In that case, I want the query just return the line containing channel "A" since in that case there were 5 sales vs 4 sales to the same store with different rating.
ID_Loja: 1
Canal: A
Count(Valor_Venda): 5
ID_Loja: 1
Canal: B
Count(Valor_Venda): 4
So far, I’ve only done query that brings the amount of sales per store/channel, but I could not bring only the combination that has more sales per store/channel only.
SELECT ID_Loja, Canal, COUNT(Valor_Venda)
FROM Vendas
GROUP BY ID_loja, Canal
Exact duplicate. I just answered your question in your previous question.
– George Wurthmann