This is a discussion on "SQL Syntax for adding multiple rows together from 1 column" within the Databases section. This forum, and the thread "SQL Syntax for adding multiple rows together from 1 column are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
SQL Syntax for adding multiple rows together from 1 column
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Hello-
I want to add the column office_cost for all rows that are owned by a particular company. How can i do that? The column is a decimal 5,2 and needs to total all rows for that company so i can output a total cost. |
|
|
|
|||
|
Re: SQL Syntax for adding multiple rows together from 1 column
You should use a sum function on the column that you want to total up, and a group by clause to combine each bundle of records. Here's an example of houses for sale and the seller which totals up the value of properties for each selling agent.
|
|
|||
|
Thanks, I got it!
|
|
|||
|
Re: SQL Syntax for adding multiple rows together from 1 column
|
![]() |
| Tags |
| sql, syntax, adding, multiple, rows, together, column |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding 1 to Column Value | Jack Franklin | PHP Forum | 4 | Feb 3rd, 2008 10:19 |
| Adding a column to a table | Jack Franklin | Databases | 2 | Feb 3rd, 2008 08:17 |
| Adding Content to Multiple Pages | longinwa | Starting Out | 5 | Jun 19th, 2007 00:26 |
| multiple rows => 1row??? | ktsirig | PHP Forum | 1 | Dec 31st, 2005 21:30 |
| ..copy data from column A in Table A to column B in Table B? | gecastill | Databases | 10 | Jun 23rd, 2005 18:27 |