Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

About how to use MySQL's group_concat () function on vertica

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Today, when customers are using vertica, they want to use the group_concat () function of MySQL.

The GROUP_CONCAT function returns a string result that is composed of value concatenations in the group. Because this function is not available in vertica. So you need to develop it yourself. Fortunately, someone has already written the expansion package of the third party. Here is a brief description of how to use it in vertica.

First download the extension package that implements the group_concat () function. Here is the download address. Download it and copy it to the server of vertica.

Extract the package with the root user.

[root@v001] unzip vertica-package.zip

Change the owner of this folder.

[root@v001] chown-R dbadmin:verticadba vertica-package/

Switch to the dbadmin user.

[root@v001] su-dbadm

Go to the unzipped folder

[dbadmin@v001] cd vertica-package/

There are many expansion packages under the file, we only need the string-package package, because this package contains the group_concat () function

Enter the folder

[dbadmin@v003 vertica-package] $cd strings_package/

You know through readme.md that you need to compile before you install

If it fails to compile: execute the following statement:

[root@v001] yum-y groupinstall "Development tools" & & yum-y groupinstall "Additional Development"

[dbadmin@v003 strings_package] $make [dbadmin@v003 strings_package] $make install

The following information is prompted even if the installation is successful.

Here's the test:

Connect to the database:

Enter:

Dbadmin= > select group_concat (node_name) over () from nodes

Output result:

Test the following statement again:

Dbadmin= > select schema_name,projection_name,group_concat (node_name) over (partition by schema_name,projection_name) from (select distinct node_name,schema_name,projection_name from storage_containers) sc order by schema_name,projection_name

Output result:

You can see that it has implemented the group_concat () function of MySQL.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report