Say I've got a table like below, how do I sum up just the Weekly column by job number and work center.
+-----------+------------+---------------+--------+-----------------
| Job | Work_Date | Work_Center | Budget | Weekly |
+-----------+------------+---------------+--------+------+----------
| 5666 | 2014-02-23 | SURFACE | 155 | 5 |
| 5666 | 2014-02-23 | SURFACE | 155 | 3 |
| 5666 | 2014-02-23 | DESIGN | 200 | 6 |
+-----------+------------+---------------+----------+--------------+
Turn it into:
+-----------+------------+---------------+--------+-----------------
| Job | Work_Date | Work_Center | Budget | Weekly |
+-----------+------------+---------------+--------+------+----------
| 5666 | 2014-02-23 | SURFACE | 155 | 8 |
| 5666 | 2014-02-23 | DESIGN | 200 | 6 |
+-----------+------------+---------------+----------+--------------+
EDIT
Okay Weekly works perfectly! However, an issue I've come across is when getting the sum of budget. Generally, for each Work_Center, the budget stays the same for that specific Job AFAIK. However, there is one missing piece. A number is being added to budget and therefore, using Job 5666's budget as an example, in my Crystal Report its giving me 172 instead of 155. So I did some further digging and turns out it doesn't add duplicate Budgets like in the first table, but it'll add in a value if its not a duplicate (from my understanding).
So I found this row.
+-----------+------------+---------------+--------+-----------------
| Job | Work_Date | Work_Center | Budget | Weekly |
+-----------+------------+---------------+--------+------+----------
| 5666-8 | NULL | SURFACE | 17 | 0 |
+-----------+------------+---------------+----------+--------------+
Now if I want to add this value to the budget its not working when I try the SQL answers provided below. I've tried trimming the Job # so it just says 5666 so it was see a match in Job #s and it would add the the budget together but that hasn't worked either.
I hope my explanation is a bit clearer.