DaveBirdsall 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_r266543152
 
 

 ##########
 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            [email protected]        1
+      232 Jerry          [email protected]      2
+      232 Jerry          [email protected]        3
+      367 Aven           [email protected]       4
+      367 Aven           [email protected]         5
+      367 Aven           [email protected]       6
+
+--- 6 row(s) selected.
+```
+
++
+```
+SELECT PIVOT(vendor_id), PIVOT(vendor_email) FROM vendor GROUP BY vendor_id;
 
 Review comment:
   It might be more typical for a user here to do "select vendor_id, 
pivot(vendor_email) from vendor group by vendor_id".

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to