add the sales of my sellers

0

I am working in a database that is not well structured and due to lack of time it is necessary to work like this, starting from this I want to know how to add the sales of my salespeople, and I managed to find out what amount did in each vein and what What I need is to get a single total.

    
asked by Marco 23.08.2018 в 20:12
source

1 answer

1

You can use the SUM function of mysql. In the absence of detailed information in the question, I assume you only want to see the seller's name and the total amount. Since you have not entered the code of your query, I will limit myself to indicating you the only changes, because if I try to copy it, I may commit some syntax error.

SELECT SUM(total) as total_ventas, nombre_vendedor FROM 
... aquí van todas tus relaciones... 
GROUP BY nombre_vendedor;

It's very important that you do not forget to place the GROUP BY . Since otherwise you will get the total of ALL sellers, I do not know if I explain. If you do not understand the answer, I suggest adding the script to help you better. Greetings!

    
answered by 23.08.2018 / 21:17
source