Recently I encountered some boring things, all business processes all to MySQL function to handle, resulting in mysql CPU usage riding a tiger. SQL is a language of the speech, some processing functions including connection string, such as:
CONCAT (),
CONCAT_WS (),
the GROUP_CONCAT ().
Here to talk about the use of these functions.
1. CONCAT ()
Syntax: CONCAT (str1, str2, ... ) may have one or more parameters, the result returns a string parameter generation connections. If all arguments are non-binary strings, the result is non-binary strings. If any parameter contains a binary string, the result is a binary string. The numerical parameters will be converted into a binary string equivalent thereto, if you want to avoid this, you can use explicit type cast. Such as: SELECT CONCAT (CAST (int_col AS CHAR), char_col); if the argument contains NULL, the result to NULL. 2. CONCAT_WS () Syntax: CONCAT_WS (separator, str1, str2 , ...) The first argument is the other argument separator. Delimiter position between the two strings is connected. The separator can be a string or other parameters. If the separator is NULL, the result to NULL. If other parameters contain NULL, it will be ignored NULL. 3. GROUP_CONCAT ()
Syntax: GROUP_CONCAT ([DISTINCT] expr [ , expr ...] [ORDER BY {unsigned_integer | col_name | expr} [ASC | DESC] [, col_name ...]] [SEPARATOR str_val]) group_concat ([DISTINCT] to connect field [order BY ASC / DESC sort field] [separator 'delimiter']) to the default ',' separated.
Reproduced please specify from
time to live operation and maintenance
: http://www.ttlsa.com/html/3778.html
Reproduced in: https: //my.oschina.net/766/blog/211369