2
I have a table where I store sales performed.
The need to order sellers by quantity of sales has arisen.
In case of a tie who made the most recent sale comes first.
I can bring with sql below, the seller and time of sale, but I would like to bring already the sum of sales of each seller and if tie already ordered by time of sale.
SELECT v.vendedor, v.data_venda , v.hora_venda
FROM vendas v
ORDER BY v.data_venda desc, v.hora_venda desc
Any idea ?
The sale value is in the same table?
– Pedro Camara Junior
The sale value is irrelevant, only the quantity matters.
– Pedro Augusto
Put the table structure Sales.
– Diego Souza
It only makes sense if you have more than one sale to a seller at the same time .
– Mayllon Baumer