1

I have table with 500+ rows and I want to sum all the values in a column.

Example:

 name | number ---------------- name1 | 25 name2 | 10 name3 | 5 name4 | 20 

The total sum is: 60

I can do that via PHP but is this possible using an SQL query?

2
  • 1
    The sum() is 60, and that is a big hint. Commented Oct 28, 2020 at 0:12
  • 1
    Does this answer your question? SQL- Add up Values in a Column Commented Oct 28, 2020 at 8:44

1 Answer 1

5

Just sum():

select sum(number) as total_number from mytable 
Sign up to request clarification or add additional context in comments.

1 Comment

i dont know why i actualy didint think about this 🤦‍♂️

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.