SQL query statistics grouped summing use tips

When we do query statistics, query results are sure to encounter again grouping sum this demand, but often sql query itself is more complex, then use the group function is not possible, then this time we thought of using a temporary table approach by combining the temporary table we can achieve the desired grouping summation results. Here are just a thought, not described in detail. How to use temporary tables are free to Baidu, there may be differences in each database.

Of course, the above case can also use the code to query results once again treated to their own needs data format. Choose according to their own design ideas!

Guess you like

Origin www.cnblogs.com/lucky-susu/p/10935977.html