concat mysql database (), GROUP_CONCAT (), a function of the comparison between, three CONCAT_WS ()

Today, at the time of writing projects, see colleagues used group_concat () function and concat_ws () function, in the end what is the difference between these two functions and general concat () function.

I use the database is mysql database.

GROUP_CONCAT function:

SELECT GROUP_CONCAT (MappPolicyNo, '') FROM lcmapPolicyNo WHERE PolicyNo = 'MGU201909003';
Display results: 1111111111,111111111112,112121212,123456789,2222222222,22222222222,2222222223,25345345,3333333333111,3453322222222,3453453453,44556666,45555555555555534,6666666666666
seen : this function is a single number at a plurality of points of the policy for the tiled display manner comma

SELECT GROUP_CONCAT (1,2,3, '') from dual;
Display results: 123
This shows that the concat function and operation results are the same.

CONCAT function
SELECT concat (1,2,3, '')
Display results: 123

CONCAT_WS function
SELECT CONCAT_WS ( '', ClientCFirstName,
Display results:

 

Note: CONCAT_WS function can be stitched multiple parameters.

 

Guess you like

Origin www.cnblogs.com/dongyaotou/p/11769939.html
Recommended