MySQL Multi-Aggregated Rows in Crosstab Queries
Feb 22, 2010, 20:03 (0 Talkback[s])
(Other stories by Rob Gravelle)
"MySQL's crosstabs contain aggregate functions on two or more
fields, presented in a tabular format. In a multi-aggregate
crosstab query, two different functions can be applied to the same
field or the same function can be applied to multiple fields on the
same (row or column) axis. Rob Gravelle shows you how to apply two
different functions to the same field in order to create grouping
levels in the row axis.
"Today's topic of discussion is crosstabs, which contain
multiple aggregate functions in the row axis of a tabular
resultset. Recall from the the All About the Crosstab Query article
that an aggregate function is one that summarizes a group of
related data in some way. Examples of aggregate functions include
COUNT, SUM, AVG, MIN, and MAX. In a multi-aggregate crosstab query,
two different functions can be applied to the same field or the
same function can be applied to two or more fields. Today we'll
create a query that applies two different functions to the same
field in order to create grouping levels in the row axis."
Complete Story
Related Stories: