sum of columns mysql php

0

Hello, how are you! I need your help, I'm doing this, but the answer is very difficult to find on the internet, I've been looking for a solution for hours, I'm sorry if my question is basic,

PROBLEM: I need to add all the example sales: robert that in total would be 130 in row 0 170 in row 3 and 140 in row 4

I'm calling the data with mysql filtering only the sales of robert to sum them up in full, my table has more columns. I was trying with while but just repeating the data and adding variables did not work for me either.

I NEED: The total sum of robert's sales.

I know that for the most part my question will be very easy, I am learning :) thanks in advance

    
asked by Marco Torres 06.03.2018 в 02:29
source

1 answer

0

I do not know the complete structure of your table, but according to what I understood what you want to do. The query to add the total of sales made by Robert is as follows.

Note. It can be a possible solution to what you need, because as I mentioned at the beginning I do not know the structure of the tables.

SELECT sum(venta1+venta2+venta3) from prueba where vendedor='robert'

The sentence is to add all the values of the column sales1 plus the column sales2 and the column sales3 where the seller is Robert.

    
answered by 06.03.2018 / 02:50
source