mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
支持Pivot
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@167 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -47,7 +47,8 @@ public class OracleSQLParserResourceTest extends TestCase {
|
||||
// exec_test("bvt/parser/oracle-28.txt");
|
||||
// exec_test("bvt/parser/oracle-29.txt");
|
||||
// exec_test("bvt/parser/oracle-30.txt");
|
||||
exec_test("bvt/parser/oracle-31.txt");
|
||||
// exec_test("bvt/parser/oracle-31.txt");
|
||||
exec_test("bvt/parser/oracle-32.txt");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
SELECT * FROM
|
||||
(SELECT EXTRACT(YEAR FROM order_date) year, order_mode, order_total FROM orders)
|
||||
PIVOT
|
||||
(SUM(order_total) FOR order_mode IN ('direct' AS Store, 'online' AS Internet));
|
||||
SELECT * FROM pivot_table
|
||||
UNPIVOT (yearly_total FOR order_mode IN (store AS 'direct',
|
||||
internet AS 'online'))
|
||||
ORDER BY year, order_mode;
|
||||
|
||||
|
||||
---------------------------
|
||||
SELECT * FROM
|
||||
(SELECT EXTRACT(YEAR FROM order_date) year, order_mode, order_total FROM orders)
|
||||
PIVOT
|
||||
(SUM(order_total) FOR order_mode IN ('direct' AS Store, 'online' AS Internet));
|
||||
SELECT *
|
||||
FROM pivot_table
|
||||
UNPIVOT (yearly_total FOR order_mode IN (store AS 'direct', internet AS 'online'))
|
||||
ORDER BY year, order_mode;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user