From: http://www.cnblogs.com/babyt/archive/2009/03/12/1184249.html
A crosstab chart, as its name implies, is used to present data on rows as column indicators.
The following figure shows the data style in Figure 1.
The final result is 2.
In actual use, we can achieve this effect in two ways
First, data is organized into a cross-tabulation using SQL on the database end, and then presented as a normal report.
Here, I have excerpted the straightforward content written in the previous article.Article, Refer to this link.
Http://server.chinabyte.com/474/2591974.shtml
Based on the data, the column after crossover may be fixed or not fixed.
Note the writing method, and note that the SQL statements of different databases are also different. For example, SQL Server and Oracle are different.
Here we will provide an idea.
Second, it relies on Crystal Reports for direct implementation. At the end of the article, I provided an operation video. You can refer to the actual operation steps.
It should be noted that not all data is so standard, so some correction is required.
Crystal Reports not only support retrieving data from tables, but also support view and SQL commands, stored procedures, etc.
Therefore, you can use view or SQL commands. In the video example, I used this example.
The raw data is like this (figure 3 ),
To apply the crosstab chart, modify it as shown in Figure 1.
I made a view to simplify subsequent operations. For subsequent operations, the effects of using tables and views are the same.
View Script:
Select Year, region, indicator, ' Maximum Value ' As Value category, maximum value As Value From Test_4
Union
Select Year, region, indicator, ' Minimum value ' As Numeric category, minimum value As Value From Test_4;
At the end of the video, I performed some operations on the cross tabulation settings. For details, refer. For example:
How to remove the total fields of rows and columns
How to remove the corners in the upper left corner of the crosstab chart and other basic operations
It is particularly difficult to export a perfect Excel file from a cross table.
If this is necessary, we recommend that you use the SQL crossover method and the general report method.
Download the operation video here. Unzip it with the password babyt.
/Files/babyt/cr20080505.rar
(This video is animated)