concat_ws, spilt, sort_array,size

concat_ws, spilt, sort_array,size_第1张图片

这三个字段,通过各个函数结果

concat_ws    

用相应符号将各字段连接起来  string类型

select concat_ws(',',user_id,mobile,system) as concat
from statistic.qz_track
limit 5;


concat
"13742988,,android"
"38643821,+8613075351265,android"
"11230781,,android"
"38702379,,android"
"0,+8613414655611,android"

spilt  

将上述结果通过spilt , 分开

select split(concat_ws(",",user_id,mobile,system), ",")  con_sp
from statistic.qz_track
limit 5;


con_sp
"[""13742988"","""",""android""]"
"[""38643821"",""+8613075351265"",""android""]"
"[""11230781"","""",""android""]"
"[""38702379"","""",""android""]"
"[""0"",""+8613414655611"",""android""]"

sort_array  默认升序

select sort_array(split(concat_ws(",",user_id,mobile,system), ",")) as con_sa
from statistic.qz_track
limit 5;

con_sa
"["""",""13742988"",""android""]"
"[""+8613075351265"",""38643821"",""android""]"
"["""",""11230781"",""android""]"
"["""",""38702379"",""android""]"
"[""+8613414655611"",""0"",""android""]"

 

 

 

 

你可能感兴趣的:(mysql)