First, CONCAT and Group_concat
1. The CONCAT () function is used to concatenate multiple strings into a single string.
Examples of Use:
SELECT CONCAT (ID, ', ', name) as con from Info LIMIT 1; return result is
+----------+
|con
|
+----------+
| 1,BIOCYC |
+----------+
2. Group_concat often used with GROUP by
The Group_concat function returns a string result that is combined by a value in the grouping
SEPARATOR delimiter
SELECT
Tbl_user.sex,
Group_concat (tbl_user.user_name SEPARATOR ' | | ') As user_name
From
Tbl_user
GROUP by
Tbl_user.sex
Sex user_name
Ladies International Hotel to see | | Normalize the Law of the Republic | | A good sad years and the country | | Send
Men's Republic | | Retro style Wide Sense | | Citi No Fun | | Kerala | | Go home several | | It's very high and high. | Hu Geng | | Share Repurchase | | Personal Unit
Second, date_format
The Date_format () function is used to display date/time data in different formats.
Date_format (Date,format)
The date parameter is a valid day. format Specifies the date/time in which the output is formatted.
Select Date_format (Time, '%y-%m-%d%h:00 ') Datespan,max (bandwith) MaxBandWidth from
TableName where time>= ' 2016-01-01 00:00:00 ' and time< ' 2016-02-24 00:00:00 ' GROUP by Datespan
The output of the Datespan column is timeformat for the date_format specified by the
This article is from the "program Ape's Cultivation" blog, please be sure to keep this source http://zhoum1118.blog.51cto.com/10054110/1744618
MySQL Common functions