trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traflm <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #875: [TRAFODION-2379] update sql reference...
Date Wed, 14 Dec 2016 15:20:41 GMT
Github user traflm commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/875#discussion_r92414734
  
    --- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
---
    @@ -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
    --- End diff --
    
    Thanks Dave, it should be ordered, I will update the text.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message