trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [trafodion] liuyu000 commented on a change in pull request #1814: [TRAFODION-3286] Add the PIVOT Function in the Trafodion SQL Reference Manual
Date Tue, 19 Mar 2019 03:43:31 GMT
liuyu000 commented on a change in pull request #1814: [TRAFODION-3286] Add the PIVOT Function
in the Trafodion SQL Reference Manual
URL: https://github.com/apache/trafodion/pull/1814#discussion_r266722029
 
 

 ##########
 File path: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
 ##########
 @@ -7096,6 +7096,152 @@ PI()
 PI()
 ```
 
+<<<
+[[pivot_function]]
+== PIVOT Function
+
+The PIVOT function transposes rows of a table into a column, aggregating data in the process
of the rotation.
+
+PIVOT is a Trafodion SQL extension.
+
+`PIVOT (_source-column_[, DELIMITER '_delimiter_'])`
+
+[[syntax_description_of_pivot]]
+=== Syntax Description of PIVOT
+
+* `_source-column_`
+
++
+is a column containing rows to be rotated.
+
+* `_delimiter_`
+
++
+is a delimiter used to separate values in a column.
+
++
+NOTE: If the `DELIMITER '_delimiter_'` is omitted, the default delimiter is a comma.
+
++
+*Example*
+
++
+The table _vendor_ is as follows:
+
++
+```
+SELECT * FROM vendor;
+
+VENDOR_ID VENDOR_NAME    VENDOR_EMAIL           VENDOR_EMAIL_ID
+--------- -------------- ---------------------- ---------------
+      111 Tom            tom@hotmail.com        1
+      232 Jerry          jerry@hotmail.com      2
+      232 Jerry          jerry@gmail.com        3
+      367 Aven           aven@hotmail.com       4
+      367 Aven           aven@gmail.com         5
+      367 Aven           aven@outlook.com       6
+
+--- 6 row(s) selected.
+```
+
++
+```
+SELECT PIVOT(vendor_id), PIVOT(vendor_email) FROM vendor GROUP BY vendor_id;
 
 Review comment:
   Thanks for your suggestion, I've corrected. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message