Doris–常用函数的使用

  • Post author:
  • Post category:其他




1. 将数据 分组后将不同的列转化为一行例如

mysql> select tagId,userid,tagTime,tagValue from tags_detailed;
+-------+--------+------------+----------+
| tagId | userid | tagTime    | tagValue |
+-------+--------+------------+----------+
|   100 |    101 | 2021-08-14 | 中国     |
|   100 |    101 | 2021-08-14 | 香港     |
+-------+--------+------------+----------+
2 rows in set (0.01 sec)



2. group_concat 子查询多字符返回

mysql>  select tagId,group_concat(tagValue) AS guoji from tags_detailed group by tagId; 
+-------+----------------+
| tagId | guoji          |
+-------+----------------+
|   100 | 中国, 香港     |
+-------+----------------+
1 row in set (0.01 sec)