| Share this post! | Vote this! |
|
Aggregation
You can use a SQL SELECT to aggregate data. Aggregation combines rows together and performs some operation on their combined values. Very common aggregations are COUNT, SUM, and AVG.The simplest use of aggregations is to examine an entire table and pull out only the aggregations, with no other columns specified. Consider this SQL:
SELECT COUNT(*) as cnt
,SUM(sale_amount) as sumSales
,AVG(sale_amount) as avgSales
FROM orders
If you have a very small sales order table, say about 7 rows, like this:
More...
RECOMMENDED READING



0 comments:
Post a Comment