
Use the SUM() Function to get the total of a specific numeric column. With that being said, the Sum function doesn't need to be a single field. In this case, you can use a formula. Kind of like, getting total Profit by subtracting Expense (Column1) from Total Sales (Column2). Below is the specific syntax to use.
SQL SUM Example:
SELECT SUM(Column1 - Column2)
FROM TableName;
Please note, you can also preform groupings while using this function as well. I will show you those at a later date.
If you like this post and want to see more, follow me on my website www.chadcompton.com
No comments:
Post a Comment
Drop me a line.