You use Sql Sum to add up values of a numeric column. The keyword 'Distinct' works for this function, it will ignore the Null values in the calculation.
The syntax:
Example: Let's use a simple table to illustrate. Expenses table, find out how much spent so far.
ExpId | Date | Description | Category | Amount |
---|---|---|---|---|
1001 | 1/07/2009 12:00:00 AM | Long Black Coffee | 1 | 3.00 |
1002 | 1/07/2009 12:00:00 AM | Newspaper | 5 | 1.00 |
1003 | 1/07/2009 12:00:00 AM | Morning Tea | 1 | 4.00 |
1004 | 1/07/2009 12:00:00 AM | Lunch | 1 | 8.00 |
1005 | 1/07/2009 12:00:00 AM | Dinner | 1 | 12.00 |
1006 | 1/07/2009 12:00:00 AM | Magazine PC World | 5 | 11.00 |
SQL statement:
The result:
Total |
---|
39.00 |
Sql Select
The core of Sql, selecting data from table.
Sql Where
Conditionally selecting rows from table.
Sql Distinct
Eliminating duplicate values in the output.
Sql Count
Counting number of rows.
Sql Max
This function will return the highest value.
Sql Min
This function will return the lowest value.
Sql Avg
This function will return the average value.
Sql Order By
Sorting the output
Sql And Or
Connecting two or more conditions in the Where or Having clause.
Sql Group By
Grouping rows into sets.
Sql Having
To filter the result of aggregation
Sql Like
Pattern searching for conditions in Where or Having clause
Sql Between
Added to conditions to show results between two values.
Return from Sql Sum to Sql Commands
All of us have at least two or three things that excite us. We could talk about these subjects for hours. Good news!. Did you know that Site Built It! can turn this type of deep interest and enthusiasm into a revenue-generating business?
Review some of the Site Build It! case studies and you'll absolutely discover something that ignites more positive ideas into your mind.
SBI! Video Tour |
Invest the most |
Golden Gate Bridge Poster
James, Vincent
Buy at AllPosters.com
Buy at AllPosters.com
Sydney Harbor Bridge, Sydney, Australia