zoukankan      html  css  js  c++  java
  • impala中的字符串拼接函数

    impala中拼接字符串的函数:

    concat(string a, string b...)
    Purpose: Returns a single string representing all the argument values joined together.
    Return type: string Usage notes: concat() and concat_ws() are appropriate for concatenating the values of multiple columns within the same row, while group_concat() joins together values from different rows.

    select concat('aaa','vvv','234')
    aaavvv234


    concat_ws(string sep, string a, string b...)
    CONCAT_WS() 代表 CONCAT With Separator 是CONCAT()的特殊形式。第一个参数是其它参数的分隔符。分隔符的位置放在要连接的两个字符串之间。分隔符可以是一个字符串,也可以是其它参数。如果分隔符为 NULL,则结果为 NULL。函数会忽略任何分隔符参数后的 NULL 值。但是CONCAT_WS()不会忽略任何空字符串。 (然而会忽略所有的 NULL)。
    SELECT CONCAT_WS(',','First name',NULL,'Last Name');

    SELECT CONCAT_WS(',','First name','Last Name','NULL');
    First name,Last Name,NULL
    SELECT CONCAT_WS(',','First name','Last Name',NULL);
    NULL

    注意:null 和任何字符串拼接都是NUll


    group_concat(string s [, string sep])
    按照指定分隔符, 将多行记录的 s 表达式结果拼接起来

    复制代码
    select id,group_concat(name,'##') from (
    select 1 as id,'zhangsan' as name
    union all
    select 1,'zhangshu'
    union all
    select 2,'wangwu'
    union all
    select 2,'wangsan'
    union all
    select 2,'wangbu'
    ) t group by id
    复制代码



    天下难事,必作于易;天下大事,必作于细
     
  • 相关阅读:
    struts1下载地址
    基础知识浮点数
    基础知识this[String]
    矩阵基础知识(二)
    矩阵基础知识(三)
    設計公司軟件開發需求分析流程
    動態調用js文件
    图片的淡入淡出的实现方法
    IIS7.5(经典/集成),IIS6,asp.net 4.0下配置Url映射(asp.net mvc)
    页面状态加载....
  • 原文地址:https://www.cnblogs.com/javalinux/p/15352161.html
Copyright © 2011-2022 走看看