MySQL - Add Values In Query And Return As Single Value

Posted by Sjwdavies on Stack Overflow See other posts from Stack Overflow or by Sjwdavies
Published on 2010-06-01T09:32:25Z Indexed on 2010/06/01 9:43 UTC
Read the original article Hit count: 166

Filed under:
|

I'm trying to query a database, and return a set of values. Part of the data i'm trying to return is an insurance premium breakdown.

Is it possible to run a query, that selects multiple fields, then adds then and returns them as a single value?

I've seen SUM() but the examples i've seen show it as adding up the results of an entire field - where as i need it to add specific fields for each row returned.

Any help is much appreciated.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql-query