Add numbers in a field in MySQL

Here's my sql statement so far

SELECT DISTINCT email, fromemail, viewnum from TABLE

I want an SQL statement that will add the numbers in the field viewnum.

Here's a sample output

email                     fromemail                 viewnum      34        4

so basically i want the statement to give me 38.

Thanks, hope this was clear.
Who is Participating?
elfe69Connect With a Mentor Commented:
SELECT SUM(viewnum) from TABLE
SELECT SUM(viewnum) from your table,,,

but this will give u an outpot only for the if u want to display sum in front of all the columns then this wont work...
so u will have to write 2 different queries and then combine the results
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.