You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2016/12/19 19:48:12 UTC

[1/3] incubator-trafodion git commit: [TRAFODION-2379] update sql reference manual about group_concat function

Repository: incubator-trafodion
Updated Branches:
  refs/heads/master d6a5b79b0 -> ac483c91e


[TRAFODION-2379] update sql reference manual about group_concat function


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/b82c05b2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/b82c05b2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/b82c05b2

Branch: refs/heads/master
Commit: b82c05b2ea9ca454c5abcccb6c4efa81b5221d52
Parents: 8d09100
Author: Liu Ming <ov...@sina.com>
Authored: Sun Dec 11 04:01:09 2016 -0500
Committer: Liu Ming <ov...@sina.com>
Committed: Sun Dec 11 04:01:09 2016 -0500

----------------------------------------------------------------------
 .../sql_functions_and_expressions.adoc          | 43 ++++++++++++++++++++
 1 file changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b82c05b2/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
----------------------------------------------------------------------
diff --git a/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc b/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
index e42da01..2b8c065 100644
--- a/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
+++ b/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
@@ -53,6 +53,8 @@ of the expression argument of the function.
 *) or the number of rows that contain a distinct value in the one-column
 table derived from the expression argument of the function (optionally
 distinct values).
+| <<group_concat_function,GROUP_CONCAT Function>> | This function returns a string result with the concatenated non-NULL 
+values from a group.
 | <<max_function,MAX/MAXIMUM Function>> | Determines a maximum value from the group of values derived from the
 evaluation of the expression argument.
 | <<min_function,MIN Function>>                 | Determines a minimum value from the group of values derived from the
@@ -3584,6 +3586,47 @@ Start/Date Time/Shipped               (EXPR)
 ```
 
 <<<
+[[group_concat_function]]
+== GROUP_CONCAT Function
+
+This function returns a string result with the concatenated non-NULL values from a group. 
+It returns NULL if there are no non-NULL values. 
+The syntax is as follows:
+
+```
+GROUP_CONCAT([DISTINCT] expr [,expr ...]
+             [ORDER BY {unsigned_integer | col_name | expr}
+                 [ASC | DESC] [,col_name ...]]
+             [SEPARATOR str_val])
+```
+
+Get the concatenated values of expression combinations. To eliminate duplicate values, 
+use the DISTINCT clause. 
+To sort values in the result, use the ORDER BY clause. To sort in reverse order, add 
+the DESC (descending) keyword to the name of the column you are sorting by in the 
+ORDER BY clause. The default is ascending order; this may be specified explicitly using
+the ASC keyword. The default separator between values in a group is comma (,). To specify 
+a separator explicitly, use SEPARATOR followed by the string literal value that should be 
+inserted between group values. To eliminate the separator altogether, specify SEPARATOR ''.
+
+[[examples_of_group_concat]]
+=== Examples of GROUP_CONCAT
+
+The following example returns concatenated strings for column test_score for each student.
+
+```
+>> SELECT student_name,
+         GROUP_CONCAT(DISTINCT test_score
+                   ORDER BY test_score DESC SEPARATOR ' ')
+         FROM student
+         GROUP BY student_name;
+STUDENT_NAME     (EXPR)
+--------------  --------------
+scott            80 90 91 56
+tom              77 43 91
+```
+
+<<<
 [[insert_function]]
 == INSERT Function
 


[3/3] incubator-trafodion git commit: Merge [TRAFODION-2379] PR 875 Add GROUP_CONCAT to SQL Reference Manual

Posted by db...@apache.org.
Merge [TRAFODION-2379] PR 875 Add GROUP_CONCAT to SQL Reference Manual


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/ac483c91
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/ac483c91
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/ac483c91

Branch: refs/heads/master
Commit: ac483c91ebaa46a47c592aeff283d60e031d6de0
Parents: d6a5b79 1e921e3
Author: Dave Birdsall <db...@apache.org>
Authored: Mon Dec 19 19:47:34 2016 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Mon Dec 19 19:47:34 2016 +0000

----------------------------------------------------------------------
 .../sql_functions_and_expressions.adoc          | 43 ++++++++++++++++++++
 1 file changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ac483c91/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
----------------------------------------------------------------------


[2/3] incubator-trafodion git commit: Update sql_functions_and_expressions.adoc

Posted by db...@apache.org.
Update sql_functions_and_expressions.adoc

for group_concat example

Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/1e921e33
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/1e921e33
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/1e921e33

Branch: refs/heads/master
Commit: 1e921e33ea7ca8984003c2235bc0790679a2e0a2
Parents: b82c05b
Author: Liu Ming <mi...@esgyn.cn>
Authored: Fri Dec 16 16:37:16 2016 +0800
Committer: GitHub <no...@github.com>
Committed: Fri Dec 16 16:37:16 2016 +0800

----------------------------------------------------------------------
 .../src/asciidoc/_chapters/sql_functions_and_expressions.adoc    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1e921e33/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
----------------------------------------------------------------------
diff --git a/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc b/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
index 2b8c065..76daacb 100644
--- a/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
+++ b/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
@@ -3622,8 +3622,8 @@ The following example returns concatenated strings for column test_score for eac
          GROUP BY student_name;
 STUDENT_NAME     (EXPR)
 --------------  --------------
-scott            80 90 91 56
-tom              77 43 91
+scott            91 90 80 56
+tom              91 77 43
 ```
 
 <<<