mysql group_concat連結行の使用方法と問題
2862 ワード
, “,” , “|||”, SEPARATOR ,
:
mysql> SELECT student_id, GROUP_CONCAT(courses_id SEPARATOR '|||') AS courses FROM student_courses WHERE student_id=2 GROUP BY student_id;
, , courses_id :
mysql> SELECT student_id, GROUP_CONCAT(courses_id ORDER BY courses_id DESC) AS courses FROM student_courses WHERE student_id=2 GROUP BY student_id;
1.int group_concat , int , char , (ExecuteScalar SQL ) , byte[]。 SQLyog , 。
select group_concat(ipaddress) from t_ip
select group_concat(id) from t_ip byte[]
select group_concat(CAST(id as char)) from t_dep
select group_concat(Convert(id , char)) from t_dep
Cast,convert :
CAST(expr AS type), CONVERT(expr,type) , CONVERT(expr USING transcoding_name)
CAST() CONVERT() , 。 : BINARY[(N)] CHAR[(N)] DATE DATETIME DECIMAL SIGNED [INTEGER] TIME UNSIGNED [INTEGER]
2. group_concat , 。 。
group_concat_max_len , 。
, val : SET [SESSION | GLOBAL] group_concat_max_len = val;
, 。 SQLyog SET GLOBAL group_concat_max_len = 10 ,
SQLyog, 。