A SQL statement that implements data classification summary

xiaoxiao2021-03-06  14

The existing table test, the content is as follows: ID Catalog Num 1 a 3 1 B 52 A 8 2 B 2 Now I want to check this result according to ID: ---------------------------------------------------------------------------------------------------- - 1 A 31 B 5 Summary Try: 82 A 8 2 B 2 Summary Try: 10 Q: How to achieve?

The ROLLUP operator is useful when generating a report containing small and total reports. The result set generated by the ROLLUP operator is similar to the result set generated by the Cube operator. ======================== The result set generated by the Cube operator is a cube. The cube is the extension of the fact data, and the fact data records the data of individual events. Extension is built on the column intended to analyze. These columns are called dimension. The cube is a result set, which contains all possible intersections of all dimensions. The Cube operator is specified in the Group By clause of the SELECT statement. The selection list of this statement should include dimension columns and aggregate functions. GROUP BY should specify the dimension column and keyword with cube. The result set will contain all possible combinations of each value in the dimension column, and the aggregate value in the base line that matches these dimension values. ========================== Cube and Rollup differences between: CUBE generated result set shows all combinations of the selected column value polymerization. The result set generated by the Rollup showed the aggregation of a hierarchy of the selected column value.

The Cube Operator is used by the rult set...

The Differences Between Cube and Rollup Are:

.

The last query statement is as follows:

转载请注明原文地址:https://www.9cbs.com/read-48212.html

New Post(0)