Adding values from a column in MySQL

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
HansKippenhagen
Forum Newbie
Posts: 1
Joined: Fri Jun 20, 2003 11:06 pm

Adding values from a column in MySQL

Post by HansKippenhagen »

Does anyone know how to add all of the values in a column. I suppose you could use mysql_fetch_array but i was wondering if there were a easier way. thanks
User avatar
trollll
Forum Contributor
Posts: 181
Joined: Tue Jun 10, 2003 11:56 pm
Location: Round Rock, TX
Contact:

Post by trollll »

Try using:

Code: Select all

SELECT SUM(column_name) FROM table_name;
Post Reply