SQL- Add up Values in a Column
SQL Server or MySQL:
select sum(MyColumn) as MyColumnSum from MyTable
If you need to sum a column by a grouping of another column
select sum(MyColumn) as MyColumnSum, OtherColumn from MyTable Group By OtherColumn
Here is a way to, separately, add up negative or positive numbers
select sum( case when MyColumn < 0 then MyColumn else 0 end ) as NegativeSum, sum( case when MyColumn > 0 then MyColumn else 0 end ) as PositiveSumfrom MyTable
Reference
Take a look at the SUM()
function documentation for MySQL.
SELECT YourRecordID, SUM(Gross) AS GrossSumFROM YourTableGROUP BY YourRecordID