- 6
- 0
- 约7.5千字
- 约 4页
- 2017-05-28 发布于河南
- 举报
esProc Simplifies SQL-style Computations – Transpose Rows and Columns
esProc Simplifies SQL-style Computations – Transpose Rows and Columns
During database application development, we often need to deal with complicated SQL-style computations. The
transposition of rows and columns is one of them. Oracle uses pivot function to realize this computation. The other
databases haven’t the counterparts to realize it directly, which makes the corresponding code difficult to write,
understand and maintain. Besides, even the pivot function can only transpose the fixed columns, but is powerless about
the unfixed ones. So are the other databases. Generally all of them must resort to the high level programming languages
to realize the dynamic SQL.
However, coding this computation with esProc will be concise and easy to understand. We ’ll use an an example to
illustrate this.
The following figure shows part of the SALES - a database table where order data are stored.
OrderID Client SellerId Amount OrderDate
1 DSG 13 19480 2014-06-20 00:00
2 ERN 18 979 2014-06-13 00:00
3 JFE 19 28972 2014-12-11 00:00
4 OFS 21 4829 2014-02-24 00:00
5 ERN 22 21392 2014-02-01 00:00
It is required to compute the total order amount, the maximum and minimum order amount, and the total number of
orders of each month of the year 2013, and then transpose the data into a table with thirteen columns and four rows, in
which the four operations occupy the first column, with subtotal being the column name, and every month covers a
column, with the column names being 1, 2, 3, 4 … The first five fields are as follows:
subtotal 1 2 3
您可能关注的文档
- esProc Simplifies SQL-style Computations – Data Grouping with Fixed Criteria.pdf
- 造型师付费,这款App帮顾客预约美容服务.pdf
- BEC中级真题解析_第二辑T2P3.pdf
- 04208731谢仁贵验收报告.pdf
- 2009年第13期(总第141期).pdf
- 时装周街拍单品即搜即买?Google与rewardStyle达成战略合作.pdf
- Android自定义Button的背景和字体样式.pdf
- 测厚仪说明书.pdf
- 新托福考试阅读练习资料:Evolution defines shopping style.pdf
- 04-Wal-Mart(英文).pdf
原创力文档

文档评论(0)